?
Solved

Windows Forms Combobox

Posted on 2016-07-19
2
Medium Priority
?
38 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 2000 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

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…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

762 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