1
Answer

# checkedListBox

Arun Kurmi

Arun Kurmi

11y
1.2k
1
hi friends,

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

Thanks in advance.......


        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";
            }
        }
Answers (1)
Next Recommended Forum