choosing an item in combo-box in a web page from win form
first:
I have a web page with a combo-box in it.the combo-box(x_date) always have
three items but the text and the value of those items change every day and
the format of the web page is html. the web page load in
web-browser(webbrowser1) in win form
combo-box code in HTML:
<select name="x_date" id="textboxes" style="font-family:Tahoma;
color:#000000; font-size:11px">
<option value="2013-07-21">Non-stationary text1
</option>
<option value="2013-07-20">Non-stationary text2
</option>
<option value="2013-07-19">Non-stationary text3
</option>
</select>
second:
I have a win form application with a combo-box(CB)with three items (1,2,3)
and a button.
what i want to do:
I want to change the selected item in the web page to the selected item in
win form when i press the button.
example:
the selected item in my CB is "2".when click the button the selected item
in x_date changes to "Non-stationary text2".(the default selected item in
x_date is "Non-stationary text1")
what i have tried:
webBrowser1.Document.GetElementById("x_date").InvokeMember("click");
//(noting happend)
AND
webBrowser1.Document.GetElementById("x_date").InvokeMember("focus");
//(this line focus on x_date but i don't know how to change the selected
item)
And for changing the item when it focused on x_date i tried this code:
webBrowser1.Document.GetElementById("x_date").InvokeMember("up");
or
webBrowser1.Document.GetElementById("x_date").InvokeMember("down");
thanks in advance! and thank for spending your time to read my question.
No comments:
Post a Comment