Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding items to combobox
Message
From
05/10/2005 12:29:57
 
 
To
05/10/2005 10:12:33
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
01054999
Message ID:
01056344
Views:
38
Mike,

You can change it programmatically by setting the .SelectedIndex. You'll see the change in the Combo when you do this, however, because it's databound, you also have to issue an .EndCurrentEdit() on the binding before it gets saved into your bound table.
this.MyCombo.SelectedIndex = 2;
this.BindingContext[this.MyTable].EndCurrentEdit();
Where MyTable is the DataTable where you've bound the .SelectedValue (not the DataSource of your Combo).

~~Bonnie


>How come when I fill the combobox by binding it to a datatable, I can't programatically change which item I want displayed? I tried changing .selectedtext, .selecteditem,
>.text, and using .FindStringExact, but I can't make it change the value.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform