Re: populating cobobox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • molikoe
    New Member
    • Feb 2008
    • 1

    Re: populating cobobox

    I am asking for help. I want to populate combo box dynamicaly using records from the database
  • daniel aristidou
    Contributor
    • Aug 2007
    • 494

    #2
    Originally posted by molikoe
    I am asking for help. I want to populate combo box dynamicaly using records ffrom the databes
    Ok which version of vb are you using......if you are using vb08 this is quite simple...Go to data bindings in the data bindings section of the properties....y ou will find 4-5 fields one is called text...the other is value and the others...i can't recall...value is the option of inserting what is in the combo to the field....text is the text that will appear in the combo box from the database field

    Comment

    • jamesd0142
      Contributor
      • Sep 2007
      • 471

      #3
      Put you database connection script above this:
      [code=vbnet]
      cboLN03.Items.C lear()
      Reader = Cmd.ExecuteRead er()
      While Reader.Read()
      For Columns = 0 To Reader.FieldCou nt - 1
      Category = Reader.Item(Col umns) 'READ COLUMN FROM DATABASE
      Next
      cboLN03.Items.A dd(Category)
      ComboRow += 1
      End While
      Con.Close()
      [/code]

      cboLN03 is the combobox

      Comment

      Working...