Question WebBrowser control, programmatically select dropdown and execute javascript

alanlau

New member
Joined
Sep 23, 2014
Messages
3
Programming Experience
10+
I'm trying to select an item in a drop down list on a web page that is displayed in a WebBrowser control in a VB application. Selecting the item is no problem, I just loop through the children of the HTMLSelectElement until I find the value I want and then set the .Selected property for that element to true.

The problem is this control has some javascript in it that refreshes the page when its value changes. Here's the HTML for the control (for which I can not change):

HTML:
<select name="SearchType" onchange="javascript:setTimeout('__doPostBack(\'SearchType\',\'\')', 0)" id="SearchTypeID" style="width:95%;" class="valid">    <option selected="selected" value="-1">-Select one-</option>    <option value="01">NAME</option>    <option value="02">DEPARTMENT ID</option></select>

My question is how do I make my VB program execute the code in the onchange property?

The website that I'm trying to automate is here: DAT: UCC and Charter Search
 
Back
Top