jeudi 2 mai 2019

How to load values from combobox to checkedListBox

What I need: I need a comboBox and a checkedListBox with exact same values. I have a button to add values and delete values.

Here is my Add button:

private void button5_Click(object sender, EventArgs e)
    {
        checkedListBox1.Items.Add(comboBox1.Text);
        comboBox1.Items.Add(comboBox1.Text);
        comboBox1.Text = "";
    }

and my Delete button:

private void button6_Click(object sender, EventArgs e)
    {
        comboBox1.Items.Remove(comboBox1.SelectedItem);
    }

I would like to be able to delete the entries in the checkedListBox without having to select it first, I only need it to be selected into the comboBox1.




Aucun commentaire:

Enregistrer un commentaire