| | |
AttachEventHandler issues
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2008
Posts: 114
Reputation:
Solved Threads: 6
i have a web browser control which i have added a status strip.
I can get the status strip to display the clicked link fine but i would like it to display the link target when the mouse is hover over the link but i cannot get it to work!
My code is below - any help is greatly appreciated!
I can get the status strip to display the clicked link fine but i would like it to display the link target when the mouse is hover over the link but i cannot get it to work!
My code is below - any help is greatly appreciated!
VB.NET Syntax (Toggle Plain Text)
Private Sub mainWebBrowser_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles mainWebBrowser.DocumentCompleted Dim Olink As HtmlElement Dim Elem As HtmlElementCollection = mainWebBrowser.Document.Links 'check the link that has been clicked For Each Olink In Elem 'call the procedure to check if this is a valid link Olink.AttachEventHandler("onclick", AddressOf LinkClicked) Olink.AttachEventHandler("mousemove", AddressOf LinkStatus) Next End Sub Private Sub LinkClicked() Accepted = False Dim link As HtmlElement = mainWebBrowser.Document.ActiveElement Dim url As String = link.GetAttribute("href") Call CheckLinkClicked(url) 'Call SearchValue() If Accepted = True Then mainWebBrowser.Navigate(url) ToolStripStatusLabel2.Text = url & "(Allowed)" Else bCancel = True ToolStripStatusLabel2.Text = url & "(not allowed)" MsgBox("That is not an allowed URL" & Chr(13) & Chr(10) & "If this is wrong, then someone needs to enter this site into the allowed list!") End If urlTextBox.Text = mainWebBrowser.Url.ToString End Sub Sub LinkStatus() Accepted = False Dim link As HtmlElement = mainWebBrowser.Document.ActiveElement Dim url As String = link.GetAttribute("href") Call CheckLinkClicked(url) 'Call SearchValue() If Accepted = True Then ToolStripStatusLabel2.Text = url & "(Allowed)" Else ToolStripStatusLabel2.Text = url & "(not allowed)" End If End Sub
![]() |
Other Threads in the VB.NET Forum
- Previous Thread: detecting delete on row in datagridview and updating dataset
- Next Thread: [HELP] Please Check this thread its urgent!
| Thread Tools | Search this Thread |
"crystal .net .net2005 30minutes 2005 2008 access account arithmetic array basic binary bing button buttons center check code combobox component connectionstring convert crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dosconsolevb.net dropdownlist excel file-dialog firewall folder ftp generatetags hardcopy image images insert intel internet isnumericfuntioncall login math memory mobile monitor ms navigate net networking opacity output passingparameters peertopeervideostreaming picturebox1 port problem problemwithinstallation project reports" save savedialog searchvb.net select serial soap string tcp temp text textbox timer toolbox trim update updown user useraccounts usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web wpf





