Results 1 to 5 of 5

Thread: WebBrowser / Submitting A Form

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2009
    Posts
    90

    WebBrowser / Submitting A Form

    I am having trouble submitting a form with my program which is using the WebBrowser control.

    Code:
    WebBrowser.Document.All("follow").InvokeMember("click")
    I tried this but it did not work. The result is that the WebBrowser displays "This program cannot display the webpage" error page. The problem I think, is that the page is using javascript when it comes to submitting the form.

    This is the code for the submit button:
    Code:
    <input type="button" onclick="submitIt()" value="Follow" name="follow"/>
    And this is the javascript for the onclick="submitIt()"
    Code:
    function submitIt(){
       document.formx.submit();
    }
    So how can I submit this form? Is there any way to invoke that javascript submitIt() method through VB.net? Or am I missing a better way to do this?
    Last edited by Aeterna; Mar 28th, 2009 at 10:57 PM.

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Mar 2009
    Posts
    90

    Re: WebBrowser / Submitting A Form

    Nobody has any ideas on this?

  3. #3
    Frenzied Member
    Join Date
    Mar 2005
    Location
    Sector 001
    Posts
    1,577

    Re: WebBrowser / Submitting A Form

    You shouldn't name your controls as their classes.
    Code:
    WebBrowser.Document.All.Item("follow").InvokeMember("click")
    VB 2005, Win Xp Pro sp2

  4. #4
    New Member
    Join Date
    Jun 2009
    Posts
    5

    Re: WebBrowser / Submitting A Form

    Try navigating webbrowser with a javscript :P



    Code:
    javascript:document.formx.submit();
    Or


    Code:
    javascript:document.formx.submit()

  5. #5
    New Member
    Join Date
    Jun 2009
    Posts
    2

    Re: WebBrowser / Submitting A Form

    You could try this code:

    Code:
    Webbrowser1.Document.GetElementById("follow").InvokeMember("Click")

Tags for this Thread

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