I have implemented Admob in my Windows app, a both banner and interstitialAd. Banner works kind of (when clicking it in windows the text in the ad sometimes gets selected instead of it firing the ad).
When the interstitialAd shows up, which it does fine, when the ad is clicked/touched it just disappears. It does direct the user to the ad site. It just goes back to the app.
My code:
Public Sub showIntAd()
Dim IntAd As InterstitialAd = New InterstitialAd(INT_AD_UNIT)
Dim AdRequest As AdRequest = New AdRequest()
'AdRequest.ForceTesting = True
AddHandler IntAd.ReceivedAd, AddressOf OnAdReceived
AddHandler IntAd.FailedToReceiveAd, AddressOf adFailed
IntAd.LoadAd(AdRequest)
End Sub
Public Sub loadBannerAd(adReq As AdView)
adReq.Format = AdFormats.SmartBanner
adReq.AdUnitID = BANNER_AD_UNIT
Dim AdRequest = New AdRequest()
'AdRequest.ForceTesting = True
'BuildLocalizedApplicationBar()
adReq.LoadAd(AdRequest)
End Sub
Private Sub adFailed(sender As Object, e As AdErrorEventArgs)
'DO NOTHING
End Sub
Private Sub OnAdReceived(ByVal sender As Object, ByVal e As AdEventArgs)
Dim intAd As InterstitialAd = CType(sender, InterstitialAd)
intAd.ShowAd()
End Sub
Any ideas?
In my splash screen i have the following:
AddHandler Touch.FrameReported, AddressOf screenTapped
The sub screenTapped dismisses the splash screen. This code seems to affect the Admob InterstitialAd for some reason, although the ad is called on the second screen. I removed this code and its working fine now.
Related
I have a website written in ASP.Net . On one page I have a table of images. Those images are stored in folders. There is a drop down box that displays the various folder names. When a user selects folder name from the drop down, then the images in that folder are displayed in the table.
The issue is that as soon as a folder is selected in the drop down box, then none of the images on the page can be downloaded in Chrome. If you right click on an image and select "Save Image As.." and click Save, Chrome returns with an error "Interrupted - Network Error" . You can click resume and the file downloads . You can open the image in a new tab and download the file. It also causes all images on the page to not download , including static ones such as the logo on the header. It works fine in Firefox. The images are quite small 420 K or so. The code for the page is very simple, in fact the code that occurs on page load is almost identical to the code that occurs on selecting an item from the drop box. This happens to all our website users , so definitely not some plug in or antivirus etc. Any ideas why selecting a folder from the drop box may cause an issue? Following is the page code
``
Imports System.IO
Partial Class m_Images
Inherits System.Web.UI.Page
Private imgPath As String
Dim strFolderName As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
For Each d In System.IO.Directory.GetDirectories(Server.MapPath("~\images\ClientImages"))
Dim dir = New DirectoryInfo(d)
Dim dirName = dir.Name
lstCategories.Items.Add(dirName)
Next
strFolderName = lstCategories.SelectedItem.Text.Trim
imgPath = Server.MapPath("~\images\ClientImages\" + strFolderName + "\")
Session("FolderName") = strFolderName
Dim directoryInfo As DirectoryInfo = New DirectoryInfo(imgPath)
If directoryInfo.Exists Then
DataList1.DataSource = directoryInfo.GetFiles("*")
DataList1.DataBind()
Else
DataList1.DataSource = Nothing
DataList1.DataBind()
End If
End If
End Sub
Protected Sub lstCategories_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstCategories.SelectedIndexChanged
strFolderName = lstCategories.SelectedItem.Text.Trim
imgPath = Server.MapPath("~\images\ClientImages\" + strFolderName + "\")
Session("FolderName") = strFolderName
Dim directoryInfo As DirectoryInfo = New DirectoryInfo(imgPath)
If directoryInfo.Exists Then
DataList1.DataSource = directoryInfo.GetFiles("*")
DataList1.DataBind()
Else
DataList1.DataSource = Nothing
DataList1.DataBind()
End If
End Sub
Protected Function GetFolderName() As String
imgPath = Session("FolderName")
Return imgPath
End Function
End Class
``
Tried different desktops, and browsers. The problem is limited to Chrome (and Chromium based browsers such as Opera) . The problem occurred on at least 50 desktops scattered throughout the country.
So i basicly made a code to follow people on twitter if i click my button i follow 10 people with 1 click.
No my problem is, if i scroll down in my vb. webbrowser so i get a list of about 200-300 people and i want to follow them with my button
my program doesnt respond anymore. I think because its just too much button clicks with 1 click.
So how can i follow like 1 person then the other one and so on? And not all at the same time?
My Code:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
WebBrowser1.Navigate("https://twitter.com/YG/followers")
Dim Rect As Rectangle = Me.WebBrowser1.Document.Body.ScrollRectangle
Dim BodySize As New Size(Rect.Width, Rect.Height)
Me.WebBrowser1.Size = BodySize
End Sub
Declare Sub Sleep Lib "kernel32.dll" (ByVal Milliseconds As Integer)
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim allelements As HtmlElementCollection = WebBrowser1.Document.All
For Each webpageelement As HtmlElement In allelements
'<button class="user-actions-follow-button js-follow-btn follow-button btn small small-follow-btn"
'button-text follow-text
If webpageelement.GetAttribute("className") = "button-text follow-text" Then
webpageelement.InvokeMember("click")
webpageelement.InvokeMember("MouseDown")
webpageelement.InvokeMember("MouseUp")
webpageelement.RaiseEvent("OnClick")
webpageelement.Focus()
If webpageelement.GetAttribute("className") = "button-text following-text" Then
End If
End If
Next
End Sub
I've got a treeview control in my form. I would like to be able to edit the node in the tree and push the change to Access DB. However, I'm having trouble finding an appropriate event. MSDN treeview events reference page advices AfterLabelEdit, but I am not able to get it to work. Is anyone aware of any workaround/solution?
Snippet of the code I use (I've added onClick and onDblClick for comparison, as they work):
Private Sub xMyTreeview_Click() 'OK
testit
End Sub
Private Sub xMyTreeview_DblClick() 'OK
EditLabel
End Sub
Private Sub xMyTreeview_AfterLabelEdit() 'Problem
AfterLabel
End Sub
Sub EditLabel()
Me.xMyTreeview.StartLabelEdit
End Sub
Sub AfterLabel()
MsgBox prompt, vbOKOnly, "afterlabel"
End Sub
Sub testit()
Dim nodSelected As MSComctlLib.Node ' a variable for the currently selected node
Set nodSelected = Me.xMyTreeview.SelectedItem ' get the currently selected node
NodesStrLength = Len(nodSelected.Key)
Dim NodeStr As String
Dim StrToChange As String
StrToChange = nodSelected.Key
NodeStr = Mid(StrToChange, 2, NodesStrLength - 1)
Me.txtNodeID = NodeStr
Me.sfrmDOCNODE.Visible = True
End Sub
Your link is to the .net Windows Form Treeview but MSComctlLib is the older Visual Basic Common Controls: http://msdn.microsoft.com/en-us/library/aa443023(v=vs.60).aspx
Note the event prototype is different; if you don't declare it with the correct arguments it will never get raised;
Private Sub object_AfterLabelEdit(cancel As Integer, newstring As String)
I'm having an issue with report events that I haven't
encountered before in Access prior to Access 2007.
I'm using using Access 2007 for a Front-end to a SQL Back-end.
I have a Class, ReportEvents, that I use for the reports.
In a report's Report_Open event I instantiate and then use this class to
handle events like activate, Close, NoData and I also put common code
such as exporting data to excel instead of a report.
This code was working fine in a previous Access 2003 application (mdb) I was using,
but it isn't working as expected in 2007 (accdb). In my tests the call to a non event public sub, ProvideXLOption works like a charm, but none of the events are being fired
from the ReportEvents class. I didn't change the code I just imported it into the
project. I set up break points but they aren't being hit. I changed all of them to
public events and then called them within the test reports event and they worked fine.
I set up another report in Access 2007 with the same results. I've checked
the startup settings in Access and they are fine. I even removed and re-added
the database location from the trusted locations without any luck.
Has Microsoft modified the Events Code or is this just a simple code error on my part that I'm not seeing? It's gotta be something simple. My brain is just toast (my son decided to stay awake after last night's feeding).
Class ReportEvents Code:
Option Compare Database
Option Explicit
Private WithEvents rpt As Access.Report
Const strEventKey As String = "[Event Procedure]"
Public Property Set Report(Rept As Access.Report)
Set rpt = Rept
With rpt
.OnActivate = strEventKey
.OnClose = strEventKey
If LenB(.OnNoData) = 0 Then
.OnNoData = strEventKey
End If
End With
End Property
Public Sub Terminate()
On Error Resume Next
Set rpt = Nothing
End Sub
Private Sub rpt_Activate()
LoadPrintRibbon
End Sub
Private Sub rpt_Close()
Me.Terminate
End Sub
Private Sub rpt_NoData(Cancel As Integer)
Dim strMsg As String
strMsg = "No Records were found that match your criteria."
MsgBox strMsg, vbInformation, rpt.Name & _
": No Match. Report Cancelled"
Cancel = True
End Sub
Private Sub LoadPrintRibbon()
#If AccessVersion >= 12 Then
If rpt.RibbonName <> "PrintPreview" Then
rpt.RibbonName = "PrintPreview"
End If
#End If
End Sub
';;Provides user with option to send data to Excel instead of a report
Public Sub ProvideXLOption(Cancel As Integer)
'... some XLOption Code
End Sub
In the Test Report Code:
Private Sub Report_Open(Cancel As Integer)
Dim rptEvts As ReportEvents
Set rptEvts = New ReportEvents
Set rptEvts.Report = Me
';;Let User User Choose to Export Data to Excel or Display the report
rptEvts.ProvideXLOption Cancel
End Sub
I figured it out. It was a scope issue The ReportEvents class variable rptEvts, was inside the Report_Open sub. Because of this it wouldn't exist when the other events happened. It should be at the module level and not within the procedure.
Dim rptEvts As ReportEvents
Private Sub Report_Open(Cancel As Integer)
Set rptEvts = New ReportEvents
Set rptEvts.Report = Me
';;Let User User Choose to Export Data to Excel or Display the report
rptEvts.ProvideXLOption Cancel End Sub
End Sub
It's amazing what a little rest will do for you.
I have code, similar to the following, that I would like to modify:
Sub SendEmail()
Dim myOlApp As Outlook.Application
Dim myItem As Outlook.MailItem
'Create an Outlook application object
Set myOlApp = New Outlook.Application
'Create a new MailItem form
Set myItem = myOlApp.CreateItem(olMailItem)
'Build and display item
With myItem
.To = “test#test.com”
.Subject = “Test Subject”
.HTMLBody = “Test Body”
.Display
.SaveAs “C:\Test.msg”, olMSG
End With
End Sub
This code is called from various buttons throughout the application. When a button is clicked, a new email is created and saved. Unfortunately, the email is saved as soon as it is created and BEFORE it is sent... so, if any modifications are made to it, they will not be in the saved version.
What can I do to modifiy this code to ONLY save the email once it has been sent?
Feel free to ask any followup questions as necessary and I will respond as best I can.
Thanks!
Robert
You can use Outlook events with Access. For this example you will need a Class Module called clsOlMail with this code:
''Requires reference to the Microsoft Outlook x.x Object Library
Dim WithEvents conItems As Outlook.Items
Private Sub Class_Initialize()
Set oApp = Outlook.Application
Set oNS = oApp.GetNamespace("MAPI")
Set conFolder = oNS.GetDefaultFolder(olFolderSentMail)
Set conItems = conFolder.Items
End Sub
Private Sub Class_Terminate()
Set conItems = Nothing
Set conFolder = Nothing
Set oNS = Nothing
Set oApp = Nothing
End Sub
Sub ConItems_ItemAdd(ByVal Item As Object)
Dim frm As Form
Set frm = Forms!frmEmailDetails
frm.txtSenderName = Item.SenderName
frm.txtSentOn = Item.SentOn
frm.txtTo = Item.To
frm.txtCreationTime = Item.CreationTime
frm.txtBCC = Item.BCC
frm.txtCC = Item.CC
frm.txtSentOnBehalfOfName = Item.SentOnBehalfOfName
frm.txtSubject = Item.Subject
frm.txtBody = Item.Body
End Sub
You will also need a form called frmEmailDetails with these textboxes:
txtSenderName, txtSentOn, txtTo, txtCreationTime, txtBCC, txtCC, txtSentOnBehalfOfName, txtSubject, txtBody
And this code:
Private oEvent As clsOLMail
''Requires reference to Microsoft Outlook x.x Object Library
Public oApp As Outlook.Application
Public oNS As Outlook.NameSpace
Public conFolder As Outlook.MAPIFolder
Private Sub Form_Open(Cancel As Integer)
Set oEvent = New clsOlMail
End Sub
Open the form and send an email through Outlook, you can use one of the examples shown above. The form fields should fill with the relevant details from the sent email. You are likely to get an Outlook security warning.
From: http://wiki.lessthandot.com/index.php/Access_and_Email
The problem is there is no EntryID for the newly created item. Once you save/send this item, the reference is no longer good. Why is probably due to how MAPI works. Remou suggests using the ItemAdd event to handle the item newly added to the special folder "Sent Items". From this event you can save the message. The only issue I see is how would you know passed item is the sent item. You are calling Display, which allows the user to preview, edit, send, or close the message without sending. Therefore, the item may not be the mail item you created. To get around this, add a custom property to your mail item. When the ItemAdd event is fired, you can inspect the passed item for the custom property, and save if needed.