Results 1 to 2 of 2

Thread: how to fill a combobox with databasefields

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2001
    Posts
    103

    how to fill a combobox with databasefields

    how do you fill a combobox with databasefields?

  2. #2
    Member TheReverend's Avatar
    Join Date
    Jan 2002
    Location
    50° 51' N, 51° 13' W
    Posts
    50
    This is how i did it sucking data from SQlServer 2000

    In a windows application you would create a dataset (ds)
    create a sqldataadapter (da)
    then set the DataSource of your combo box to the content you want(eg ds.TypeValue)
    - DisplayMember to the value
    - ValueMember to the same value.
    - Also set the DropDownStyle to DropDownList.

    then in code (on button_click, FormLoad etc)

    ds.Clear()
    da.Fill(ds, "TypeValue")

    where typevalue is the column from the table you are accessing in the dataset

    sorry if it seems badly explained but i am just learning myself
    To live is the rarest thing in the world. Most people exist, that is all.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width