Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to store hand-typed combobox values
Message
De
25/07/2003 15:34:27
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00813616
Message ID:
00813621
Vues:
8
Don,

Typically the .DisplayMember will be from the DataSource, not from the Bound data. I'm assuming that you did it this way because your arraylist has only one dimension. I've not found an easy way to use an array as a DataSource when your DisplayMember and ValueMember are two different things (I may be missing something) ... in those cases, I've just built a Table instead of an Array and used the Table for the DataSource.

~~Bonnie


>I have a combobox bound to a dataset field, with a rowsource set to an arraylist of objects containing state abbreviations. The dropdownstyle property set to "Dropdown" so I can type in a value in the textbox area.
>
>When I select an item from the Dropdown list my data can be saved to the dataset and works as expected. But when I hand-type a value (even if it matches an item in the dropdown list) nothing is changed when I save the dataset.
>
>Can someone see what I am missing in the following code? What do I need to change for hand-typed entries in the combobox
>
>******************************
>With Me.cboStates
> .DataBindings.Clear()
> .DataSource = States ' States is an arraylist
> .ValueMember = "ShortName" ' A property of arraylist objects
>
> .DisplayMember = dsCompanyInfo.Tables("CompanyInfo").Rows(0).Item("State")
> .DataBindings.Add("SelectedValue", dsCompanyInfo.Tables("CompanyInfo"), "State")
>End With
>******************************
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