Click on a text link in a web browser

Discussion in 'Code Snippets and Tutorials' started by peter516, Aug 20, 2007.

  1. peter516

    peter516 Level II

    Joined:
    Dec 23, 2006
    Messages:
    158
    Likes Received:
    0
    I have a web browser and a button in vb. And the web browser has the web page google.com. I want, when you click the button, for the web browser click on the hyperlink to the image seach. Does anyone know how to do this?
     
  2. the_skip

    the_skip Level IV

    Joined:
    Dec 25, 2006
    Messages:
    2,354
    Likes Received:
    1
    Location:
    Indiana
    You need to use this code
    Code (Visual Basic):
    1. <div class="vb" id="{CB}" style="font-family: monospace;"><ol><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"><span style="color: #b1b100;">Private</span> <span style="color: #b1b100;">Sub</span> Command1_Click<span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span></li><li style="padding: 0 5px; background-color: #f9f9f9; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;">WebBrowser1.<span style="color: #66cc66;">Navigate</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">"http://images.google.com/imghp?tab=wi"</span><span style="color: #66cc66;">)</span></li><li style="padding: 0 5px; background-color: #fff; line-height: 16px; border-bottom: 1px solid #efefef; border-left: 1px solid #999;"><span style="color: #b1b100;">End</span> <span style="color: #b1b100;">Sub</span></li></ol></div>
    This will send the web browser to the page. If you want an actual click the you will have to call an API