• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 43
  • Last Modified:

Windows Forms Combobox

I'm having difficulty adding and accessing items with values in a ComboBox.    if this was a WEB based form, I would use the ListItem object to  add text/value to a dropdown list.

This code below works for adding a item with value.  But in the SelectedIndexChanged event, the SelectedValue is always nothing.  I can see in debugging that  SelectedItem has the data I want, but how do I access just the value part?

 cboFilter.ComboBox.Items.Add(New With {Key .Text = "Settings", Key .Value = "-1"})
0
HLRosenberger
Asked:
HLRosenberger
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
have you tried:
cboFilter.Items.Add(new ListItem("Settings", "-1"))

Open in new window

0
 
HLRosenbergerAuthor Commented:
thanks.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now