Results 1 to 5 of 5

Thread: press button on webbrowser

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2002
    Posts
    87

    press button on webbrowser

    Q1)
    what i want to do is press a button, this is the code i tried:

    WebBrowser1.Document.Forms(0).SEARCH.Submit = True

    all i know is that the value of the button is 'SEARCH', i got the 'WebBrowser1.Document.Forms(0).' part from searching for
    the solution. i think there is a problem with the '.Submit = True' part, this was simply a guess, what is the correct code?

    Q2)
    how do you have a string for a part of the code, e.g.
    myvalue = value.text
    WebBrowser1.Document.Forms(0). & myvalue & .value = "whatever"
    why doesnt that work?

    Q3)
    is there an easy way to find values of text boxes/buttons on a website without copying the html?



    thanks for all help.

  2. #2
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    i think it is

    WebBrowser1.Document.Forms(0).SEARCH.Click

    or if the style of the button IS submit, then

    WebBrowser1.Document.Forms(0).submit


    #2, try this:
    myvalue = value.text
    WebBrowser1.Document.Forms(myvalue).value = "whatever"
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  3. #3
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390
    FYI.. the forms(0) can be other numbers...if the webpage has multiple forms..you may have to change the number to 1,2,3...etc till you hit it..
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  4. #4

    Thread Starter
    Lively Member
    Join Date
    May 2002
    Posts
    87
    WebBrowser1.Document.Forms(0).submit worked for pressing the button, thankyou.

    however your solution for question 2 didnt as this just changes what form, not the object on the form. any other suggestions?
    thanks.

  5. #5
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390
    I am not fully understanding your question...(#2)
    but if im looking at it right...you want to replace part of the code with a string value right?

    let me try something...

    yes you can... what you seem to want to do is set a varible from a textbox? on your form or the webpage form??

    anyway..


    VB Code:
    1. myvalue = value.text
    2. Webbrowser1.Document.Forms(0).Item(myvalue).value = "Whatever"

    that should do it
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

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