Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple Combobox with dropdown
Message
From
21/11/2002 14:22:16
 
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00724122
Message ID:
00725401
Views:
17
Jose,

Yep, you're right. If I had bothered to play around with it just a little bit more, I would have seen that binding to the "SelectedItem" would have worked just fine. Probably easier than creating a little teeny DataSet just for the purpose of filling the combo. But, anyway, both methods work.

Thanks,
~~Bonnie


>Bonnie, you are right
>
>As I've posted the DataBindings.Add method, I was linking the combo values to the dataset field, and those values do not get initialized when you load the combo via .AddRange
>
>The correct form of the DataBindings.Add, in my posted example, would be
>
>
>comboBox1.DataBindings.Add(
>    new System.Windows.Forms.Binding(
>        "SelectedItem", myDataSet, "Employee.Prefix"));
>
>The difference is "SelectedItem" instead of "SelectedValue"; this works because the Items collection is populated by the AddRange method.
>
>Thanks for the comment,
>Jose
>
>>Jose,
>>
>>For some reason, I've had trouble doing this (coded it exactly like you show, except C# instead of VB). It just wouldn't databind, so I ended up creating a DataSet and filling my combo from that. That worked.
>>
>>~~Bonnie
>>
Bonnie Berent DeWitt
NET/C# MVP since 2003

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

Click here to load this message in the networking platform