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

  • Home
  • SEARCH
  • 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 8763925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:53:53+00:00 2026-06-13T15:53:53+00:00

I’ve never dealt with checkedListBox1 until now. A program that I want to make

  • 0

I’ve never dealt with checkedListBox1 until now. A program that I want to make will benefit from using it rather than having to use numerous Checkboxes.

I have the code:

private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
    int selected = checkedListBox1.SelectedIndex;
    this.Text = checkedListBox1.Items[selected].ToString();
}

The problem with this is that each time I click on the box and it highlights, it then selects the highlighted object. What I am looking for is it to recognize a change in what has been selected, not highlighted.

What I’m also wanting to know is say if the first index item in CheckListBox is checked as well as the 3rd, how would I check to see if it is true or not?

I’m certain I will eventually figure it out but seeing the code would immensely help.

Say I have 3 boxes:
Box A = messageBox.Show(“a”);
Box B = messageBox.Show(“b”);
Box C = messageBox.Show(“c”);

It will only display the mbox if the box is checked. What I want to know is how can I have it check to see if, for example, A and C is checked so that if I pressed a button, the two messageBoxes will display either “a” and then “c”

  • 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-06-13T15:53:54+00:00Added an answer on June 13, 2026 at 3:53 pm
       private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            // a checkbox is changing
            // but value is not updated yet
    
        }
    
        private void checkedListBox1_MouseUp(object sender, MouseEventArgs e)
        {
            Debug.WriteLine(checkedListBox1.CheckedItems.Count);
            Debug.WriteLine(checkedListBox1.CheckedItems.Contains(checkedListBox1.Items[0]));
        }
    

    I think you should check it in MouseUp for whether the 1st is checked. and _ItemCheck is for when a checkbox is changing, but value not updated yet.

    See reference: http://msdn.microsoft.com/en-us/library/system.windows.forms.checkedlistbox.items.aspx

       // First show the index and check state of all selected items. 
    foreach(int indexChecked in checkedListBox1.CheckedIndices) {
        // The indexChecked variable contains the index of the item.
        MessageBox.Show("Index#: " + indexChecked.ToString() + ", is checked. Checked state is:" +
                        checkedListBox1.GetItemCheckState(indexChecked).ToString() + ".");
    }
    
    // Next show the object title and check state for each item selected. 
    foreach(object itemChecked in checkedListBox1.CheckedItems) {
    
        // Use the IndexOf method to get the index of an item.
        MessageBox.Show("Item with title: \"" + itemChecked.ToString() + 
                        "\", is checked. Checked state is: " + 
                        checkedListBox1.GetItemCheckState(checkedListBox1.Items.IndexOf(itemChecked)).ToString() + ".");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,

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.