Results 1 to 3 of 3

Thread: Set combobox to database

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2003
    Posts
    219

    Question Set combobox to database

    Will anyone show me how to set a combobox to a database data? Here's what I have. I have a Dataset1 and a DataAdapter1. In design mode:

    combobox1.DataSource = Dataset1
    combobox1.DisplayMember = DataSet1.SerialNumber

    Under DataBind settings:
    Selected Item set to: DataSet1 - Computer.SerialNumber
    Selected Value set to: DataSet1 - Computer.SerialNumber
    Text set to: DataSet1 - Computer.SerialNumber

    But so far this hasn't work. The combobox didn't display anything serial number at all.

    Many thanks for trying to help.

    ljCharlie

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    VB Code:
    1. combobox1.DataSource = Dataset1 'this should be the table too tables(0) by default
    2. combobox1.DisplayMember = "SerialNumber"

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2003
    Posts
    219
    Thanks! I got it working now. The problem I have was I did a fill with DataAdapter.fill(DataSet1, "myTable") and that is why it won't show up in my combobox.

    ljCharlie

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