Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting the default value of a list box

Status
Not open for further replies.

aaronjohn

Technical User
Mar 1, 2005
3
0
0
US
I tried this:
IHTMLElementCollection optionElements = (IHTMLElementCollection) htmlDoc.all.tags("select");
IHTMLOptionElement billingSystem = (IHTMLOptionElement) optionElements.item("billing_system",0);

if( billingSystem != null )
{ billingSystem.value = BillingSystem.ToString();
}

But it throws an exception, saying that optionElements.item returns null.

I also tried this:
IHTMLSelectElement selectElement = (IHTMLSelectElement) htmlDoc.all.tags("select");
IHTMLOptionElement billingSystem = (IHTMLOptionElement) selectElement.item("billing_system",0);

But there was the same problem. Anybody know how to do it properly?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top