Skip to content

# checkedListBox

Arun Kurmi

Asked Mar 3, 2013, 3:21 AM EST1 answer
Share
LinkedInX
hi friends,

Below code run but require two click on every item to check .why this ? How to resolve ?

Thanks in advance.......


C#
        private void CheckboxTextBox_Load(object sender, EventArgs e)
        {
            checkedListBox1.Items.Add("Bhopal");
            checkedListBox1.Items.Add("Indore");
            checkedListBox1.Items.Add("Banglure");
            checkedListBox1.Items.Add("Mumbai");
            checkedListBox1.Items.Add("Pune");
        }


        private void button1_Click(object sender, EventArgs e)
        {
            label3.Text = "Your Selected Items are :"+"\n";
            for (int i = 0; i < checkedListBox1.Items.Count; i++)
            {
                Boolean chk;
                //char chk;
                chk = checkedListBox1.GetItemChecked(i);
                //if(chk==true)
                if (chk)
                label3.Text = label3.Text + checkedListBox1.Items[i] + "\n";
            }
        }

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    i have found solution of its as

    checkedListBox1.CheckOnClick = true;//on load event of form
    0