Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1115295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T03:08:08+00:00 2026-05-17T03:08:08+00:00

Prior to this question, I asked this question on this site. (Mr Jon Skeet

  • 0

Prior to this question, I asked this question on this site. (Mr Jon Skeet answered it!)

I’m having difficulty retrieving the SelectedItem of the CheckedListBox.
Please consider my code:

public class StaticValues
{
    private string value;
    private string display;
    public StaticValues(string val, string disp)
    {
        this.value = val;
        this.display = disp;
    }

    public string Value
    {
        get
        { return value; }
    }

    public string Display
    {
        get
        { return display; }
    }
}

private void Form3_Load(object sender, EventArgs e)
{
    ArrayList dataSource = new ArrayList();
    dataSource.Add(new StaticValues("001", "Item 1"));
    dataSource.Add(new StaticValues("002", "Item 2"));
    dataSource.Add(new StaticValues("003", "Item 3"));
    checkedListBox1.DataSource = dataSource;
    checkedListBox1.DisplayMember = "Display";
    checkedListBox1.ValueMember = "Value";
}

private void button1_Click(object sender, EventArgs e)
{
    MessageBox.Show(checkedListBox1.SelectedValue.ToString()); // outputs correct SelectedValue 
    MessageBox.Show(checkedListBox1.SelectedItem.ToString()); // this one doesn't for SelectedItem
}

How will I get the SelectedItem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T03:08:09+00:00Added an answer on May 17, 2026 at 3:08 am

    Given that it’s a list of check boxes, I suspect it would be better to find all the checked items using the CheckedListBox.CheckedIndices property. From there, you can get to the individual item and find the appropriate value from it. While DisplayMember works, I suspect you’re better off casting the item to the known type and finding the value that way, unless that’s really awkward for you. There may be another way round it, but I don’t know of one. Note that the docs for CheckedListBox.ValueMember claim that it’s “not relevant to this class”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is being asked because I have no prior experience with delegate best
This follows this prior question, which was answered. I actually discovered I could remove
I was asked this question: String s = abc; // creates one String object
Prior to asking this question here, I have googled aroung. In general, people suggest
I know this question has been asked many times and we have gotten this
UPDATE : I asked this question in another form (see below), and it got
I noticed prior to posting this question that there have been similar questions posted
Please refer to my prior question here about implementing drag/drop. I got everything working
There are a series of prior questions that tangentially ask this question, but not
I realize that there was a similar question asked here , but this is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.