Solved

Windows Forms Combobox

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now