I have a WebBrowser control that is programatically created, and I have got a ContextMenuStrip working for it.
What I need to do is be able to distinguish whether the user has clicked a link or not when they right click, so I can have options on the context menu that can use the link to perform actions, such as opening the link in another WebBrowser control.
Here is the code for the generated WebBrowser:
Dim Browse As New WebBrowser WebTabs.TabPages.Add(1, "New Tab") WebTabs.SelectTab(t - 1) Browse.Name = "WebSpace" Browse.Dock = DockStyle.Fill Browse.IsWebBrowserContextMenuEnabled = False Browse.ContextMenuStrip = BrowserContextMenu AddHandler Browse.DocumentCompleted, AddressOf DocumentCompletedHandler AddHandler Browse.CanGoBackChanged, AddressOf WebSpace_CanGoBackChanged AddHandler Browse.CanGoForwardChanged, AddressOf WebSpace_CanGoForwardChanged AddHandler Browse.StatusTextChanged, AddressOf WebSpace_StatusTextChanged AddHandler Browse.ProgressChanged, AddressOf WebSpace_ProgressChanged WebTabs.SelectedTab.Controls.Add(Browse) CType(WebTabs.SelectedTab.Controls.Item(0), WebBrowser).Navigate(HomePage) t = t + 1
Please help me out, as this one has had me stuck all day