Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding items to combobox
Message
De
05/10/2005 12:29:57
 
 
À
05/10/2005 10:12:33
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
01054999
Message ID:
01056344
Vues:
39
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform