load comboBox item populated from database

jutiyi

Member
Joined
Feb 16, 2005
Messages
14
Programming Experience
1-3
i created a database in sql server.the database consists of tables.
the table has product field.
when i debug the vb.net program,i want the window form automatically load the combox box(the combox bpx consists of items that populated from that databases)

example the product field got 5 records:
shoes
clothes
food
bag
watches

then when i run the vb.net program,i want the user can select the 5 items from that comboBox.

i now only just begin learning the vb.net and sel server,so i dun't quite sure how to do it.

So,if anyone know,may u show the code to me?

Thanks you very much.
 
Use you combobox's DataSource, DisplayMember and ValueMember.

Eg:

combobox.datasource=mydatatable
combobox.displaymember = "item"
combobox.valueMember="ID" 'Not required but usefull

where Item is column of you shoes, clothes etc.

TPM
 
Populate ComboBox with items from database

Hi Jutiyi,
Take a look at the certain thread as it talks right about this ... populating ComboBox control http://www.vbdotnetforums.com/showthread.php?t=3682

Cheers ;)




I noted that search engine often gives the current thread (probably cuz of the title) and many user are visiting the same i desided to reply.
 
Back
Top