Visual Basic > Visual Basic Forums > Visual Basic General > See if the user right clicks on a link in webbrowser
Ask a questionAsk a question
 

General DiscussionSee if the user right clicks on a link in webbrowser

  • Wednesday, October 28, 2009 11:40 PMs_walker1522 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    Im trying to check and see if the right clicks on a link in a webbrowser, if so enable a button on the contextmenustrip that allows him to open it in a different tab.

    Dim Oelement as HTMLelement
    
    
    
    Private Sub ContextMenuStrip1_Opening(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ContextMenuStrip1.Opening
    
          If oElement.TagName = "A" Then
    
          mnuLink.Enabled = True
    
          Else
    
          mnuLink.Enabled = False
    
          End If       
    
    End Sub
    
    
    
    Private Sub mnuLinkNewTab_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuLinkNewTab.Click
    
            Dim ofrm As New frmBrowser
    
            AppManager.AddTab(ofrm, oElement.GetAttribute("HREF"))
    
        End Sub
    
    
    That code works on some links, but not others. Two examples would be on the bottom of Yahoo! (http://www.yahoo.com) homepage, where it says featured services, none of those links work, but where it says Do business with us, all of them work.

    Can I please ask someone to explan the problem and provide some visual code.

All Replies

  • Tuesday, November 03, 2009 12:36 PMChao KuoMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello,
    Is this web browser created by own, you derive from the WebBrowser class? I am not able to reproduce your issue for lacking of too much things. Could you elaborate more?
    Thanks
    Chao
  • Wednesday, November 04, 2009 7:28 AMChao KuoMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    We are changing the issue type to “General Discussion” because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question” by opening the Options list at the top of the post window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.

    Thank you!
    Chao