Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to populate a combobox
Message
From
21/10/2007 12:24:17
 
 
To
19/10/2007 10:17:14
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 2.0
OS:
Vista
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01262145
Message ID:
01262438
Views:
12
Sergio,

All kinds of stuff you could do to use that as your Combo's DataSource. You could put it in a table, an array (I think), an arraylist, a collection .... they can all be used as the Combo's DataSource. Whatever's easiest for you. You just set the DataSource, DisplayMember and ValueMember properties.

As far as databinding to your dataset table field, you just use this syntax:
this.MyCombo.DataBindings.Add("SelectedValue", MyTable, "MyField");
~~Bonnie


>Hello All,
>I have a windows form and I dropped a combobox on it.
>I need to bind the combobox with a dataset table field and I need to populate it with the list below :
>
>"None"
>"Flagged Occupation"
>"Homemaker"
>"Military"
>"Office, Sales"
>"Other"
>
>
>Can somebody give a quick start on how to accomplish it.
>
>
>Thanks
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