in vb.net how to assign a key to the combo box??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lathamoulali
    New Member
    • May 2008
    • 25

    in vb.net how to assign a key to the combo box??

    In VB6.0 in Combobox , you can use the ItemData to assign a key to the combo box like
    With cbobox1

    .AddItem "2D Bar"
    .ItemData(Chart TypeComboBox.Ne wIndex) = VtChChartType2d Bar

    end with

    in vb.net , i need to assign a key to the combo box how to do that ?

    Thanks,
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    A "key"? Like a keyboard key? A unique key in terms of like SQL?

    Comment

    • mafaisal
      New Member
      • Sep 2007
      • 142

      #3
      Hello

      This is the code

      Code:
              Dim Dst As New DataTable
              StrSQL = "SELECT DispName,ID From Table"
              Dap = New OleDb.OleDbDataAdapter(StrSQL, Con)
              Dap.Fill(Dst)
                  With ComboBox1
                  .DataSource = Dst
                  .DisplayMember = DispName
                  .ValueMember = ID
              End With
      In Here Combobox.Select ed Value is the Key

      Faisal

      Comment

      Working...