Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple Combobox with dropdown
Message
From
21/11/2002 12:33:19
 
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00724122
Message ID:
00725332
Views:
17
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


>Hi Roland
>It's a two step operation
>1. Filling the combo with the fixed items
>2. Binding the selected value to the dataset field
>
>You can do each of them on the designer, assigning values to:
>1. The Items collection property of the combo
>2. The DataBindings extended property (SelectedValue)
>
>Or you can just do it in code (BTW, that's what the designer does for you):
>
>comboBox1.DataBindings.Add(
>    new System.Windows.Forms.Binding(
>        "SelectedValue", myDataSet, "Employee.Prefix"));
>comboBox1.Items.AddRange(new object[] {
>    "Mr",
>    "Mrs",
>    "Miss",
>    "Ms"});
>
>
>Then whenever myDataSet contents change (i.e. after reading existing values) you should call comboBox1.Refresh();
>
>Regards,
>Jose.
>>Hi,
>>
>>This is simple but can someone explain to me how to set the properties for a combobox with Items (Collections)
>>
>>Mr
>>Mrs
>>Miss
>>Ms
>>
>>and bind it to a field in a dataset,table.
>>
>>I tried to bind the field to the selecteditem but it will not updated the field or pick up the field value when the form is first displayed.
>>
>>Thanks
>>Roland
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