Set ListBox / ComboBox Value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rambaldi
    New Member
    • Mar 2007
    • 42

    Set ListBox / ComboBox Value

    Hi there,

    I am adding items to a Listbox and a ComboBox and i would like to set their id's as a value so when i choose the attribute SelectedValue i can be able to get their ids.

    Someone can Help me?

    Thanks in Advance.
  • shweta123
    Recognized Expert Contributor
    • Nov 2006
    • 692

    #2
    Hi,

    You can use Valuemember property of Listbox and ComboBox for setting the value of each item. The value for ValueMember property will be the name of the table column whose value will be assigned to each Listbox or ComboBox item.

    e.g.
    Code:
      
                      ListBox1.ValueMember = "id"
                      ComboBox1.ValueMember = "id"

    Comment

    Working...