Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to store hand-typed combobox values
Message
 
To
25/07/2003 15:34:27
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00813616
Message ID:
00813674
Views:
7
Thanks Bonnie, but I don't seem to have any problem using an arraylist if I use the sample from the Help screens that creates individual State objects with properties, then add thos objects to the "States" Arraylist. That part seems to work fine, I just want to know how to store hand-typed values. You see what I mean - like when you use the keyboard to type into the combobox rather than picking an item from the dropdown list with the mouse.

Is there some code I need to enter to cause hand-typed ComboBox values to be stored? Everything else works as advertised.


>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
>>******************************
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform