I have a problem with webbrowser control. Code runs ok till it gets to
HtmlElement submit line where it returns a null error message
Object reference not set to an instance of an object.
The code works fine with the first element but not the second.
I would also like to save the website when the submit button is clicked.
Any help most welcome.
Thank you

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
            HtmlElement dropdown = this.wb.Document.All["ctl05_ddlGroupSelector"];
            dropdown.SetAttribute("selectedIndex", "1");
            HtmlElement submit = this.wb.Document.All["ct105_1bSubmit"];

I have made some progress since asking this question. There is nothing wrong with the code, but the button on the website is in javascript.

<td><a id="ctl05_lbSubmit" class="submit-btn redbtn dark" href="javascript:__doPostBack('ctl05$lbSubmit','')"><span>Submit</span></a></td>

So my question now is how do I do a
wb.Document.InvokeScript( );
function for the data above.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.