Charles Baldo
asked on
Selecting a value in a combobox
Hi I am new to c# winforms and came from the webapps world.
I have a combo box that has a collection value in it
County
State
Town
Private
I am reading the owner form the database and want to set the value to what it is in the database (will always be one of the collection values or null)
In the asp.net c# world I used
findValue = reader["Owner"].ToString() ;
ddOwner.SelectedValue = ddOwner.SelectedIndex = ddOwner.Items.IndexOf(ddOw ner.Items. FindByValu e(findValu e));
But in the winforms world I am getting an Error because Items has no FindByValue method defined.
How can I set the comboBox to the value i retrieved form the database?
Thanks
I have a combo box that has a collection value in it
County
State
Town
Private
I am reading the owner form the database and want to set the value to what it is in the database (will always be one of the collection values or null)
In the asp.net c# world I used
findValue = reader["Owner"].ToString()
ddOwner.SelectedValue = ddOwner.SelectedIndex = ddOwner.Items.IndexOf(ddOw
But in the winforms world I am getting an Error because Items has no FindByValue method defined.
How can I set the comboBox to the value i retrieved form the database?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER