Solved

Windows Forms Combobox

Posted on 2016-07-19
2
28 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
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
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:…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

685 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