Selecting a value in a combobox
Posted on 2008-10-04
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
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(ddOwner.Items.FindByValue(findValue));
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?