Solved

Windows Forms Combobox

Posted on 2016-07-19
2
33 Views
Last Modified: 2016-07-20
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
Comment
Question by:HLRosenberger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 41719483
have you tried:
cboFilter.Items.Add(new ListItem("Settings", "-1"))

Open in new window

0
 
LVL 1

Author Closing Comment

by:HLRosenberger
ID: 41721196
thanks.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question