Results 1 to 9 of 9

Thread: [Resolved]Using webbrowser with Sendkey

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2002
    Location
    United
    Posts
    202

    [Resolved]Using webbrowser with Sendkey

    i am using the Webbroswer control to open mail.yahoo.com , but when i tried to sendkeys to mail.yahoo.com , nothing happens , the cursor wasn't in the textbox .
    but however when i use shell to use internet explorer to open mail.yahoo.com(note a new internet explorer windows will be open) , i am able to send keys to login for me ?

    So any one had any idea between Shell and Webbrowser control ?
    Last edited by GOBI; Mar 11th, 2005 at 12:10 PM.

  2. #2
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871

    Re: Using webbrowser with Sendkey

    Don't use SendKeys when filling in data in the WebBrowser control; it's unreliable. Check out the articles in my signature, especially the second one.
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2002
    Location
    United
    Posts
    202

    Re: Using webbrowser with Sendkey

    Quote Originally Posted by TheVader
    Don't use SendKeys when filling in data in the WebBrowser control; it's unreliable. Check out the articles in my signature, especially the second one.
    hmm.. thnxs for the replies but after going through the 2nd articles in your signature , i notice that the 2nd article talk about creating a browser but did not say anything on filling values to a webpage like mail.yahoo.com or something similar like sendkeys .

  4. #4
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871

    Re: Using webbrowser with Sendkey

    I don't know exactly what you want to fill in, but in the second article I advocated the use of the Document Object Model to manipulate pages. If, for example, you want to insert text in the first textbox on the page, you can use this code:
    VB Code:
    1. WebBrowser1.Document.getElementsByTagName("input").item(0).value = "text"
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Feb 2002
    Location
    United
    Posts
    202

    Re: Using webbrowser with Sendkey

    Quote Originally Posted by TheVader
    I don't know exactly what you want to fill in, but in the second article I advocated the use of the Document Object Model to manipulate pages. If, for example, you want to insert text in the first textbox on the page, you can use this code:
    VB Code:
    1. WebBrowser1.Document.getElementsByTagName("input").item(0).value = "text"

    Thanks , i guess i nid to read through ur article more clearly to understand it , but one last question how do u know of all the methods and attributes that is in the document ? cos i realise mine vb 6 does not show have any drop down when i enter the webbrowser1.document. so i thought the code doesn't work at 1st ? anyway thumbs up for the help

  6. #6
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871

    Re: [Resolved]Using webbrowser with Sendkey

    In this section of MSDN you can find all methods and properties that you can use.
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Feb 2002
    Location
    United
    Posts
    202

    Re: [Resolved]Using webbrowser with Sendkey

    seems to be abit like html but 1 last question is that is it possible to use it to "fire/press enter" on a specific command button .

  8. #8
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871

    Re: [Resolved]Using webbrowser with Sendkey

    It is HTML... At least, it's a way to crawl through an HTML page.

    You can use the Click method on a command button to programmatically click it.
    VB Code:
    1. WebBrowser1.Document.getElementsByTagName("button").item(0).Click
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Feb 2002
    Location
    United
    Posts
    202

    Re: [Resolved]Using webbrowser with Sendkey

    thanks for the help .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width