<input type="button" onclick="javascript:fnnSaveChanges()" onblur="lsTest=0" onfocus="lsTest=1" value="OK">
<input type="button" onclick="window.close()" onblur="lsTest=0" onfocus="lsTest=2" value="Cancel">
</td>
<td class="clsTableElement" align="right" nowrap=""> Selecting 'Save' in the Main Window is required to Save the new settings. </td>

i've tried

WebBrowser1.Document.All.GetElementsByName("OK")(0).InvokeMember("click")

but i get


value of 0 is not valid for index. index should bebetween 0 and -1.

I tried -1 same thing

please help, thanks.

Recommended Answers

All 4 Replies

please?

pretty please?

We do something similar where we use the first set of code (modified for your scenario). If the first set works, try the second set too.

Dim okButton As HtmlElement = WebBrowser1.Document.GetElementById("OK")
  okButton.InvokeMember("click")

And

WebBrowser1.Document.GetElementById("OK").InvokeMember("click")

Do you actually need to "click the button" or do you need the function "fnnSaveChanges()" to run?

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.