vb.netmethodsbrowsersubmitinvokemember

Submit a method in webbrowser


I have a problem invoking a submit method in web page

This is my code

Webbrowser.document.forms(0).invokemember("submit")

It does nothing.

Here is the html

<form name="myWebForm" action="myServerSideScript.php" method="post"> 
    <input type="checkbox" /> Checkbox 1<br /> 
    <input type="text" /> Text Field 1<br /> 
    <input type="submit" value="SUBMIT" /> 
</form>

Solution

  • You must set .AllowNavigation property to "TRUE"

    Webbrowser.AllowNavigation = True
    

    And call submit method like this

    Webbrowser.Document.Forms(0).InvokeMember("submit")
    

    Or

    Webbrowser.Document.Forms.GetElementsByName("myWebForm").Item(0).InvokeMember("submit")