I have an exception here Application.Run(new Form1())
when I check not first item in CheckedListBox. Here's my code example
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private List<bool> l = new List<bool>() { true, false, true, true, true};
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 0; i < 5; i++)
{
checkedListBox1.Items.Add(i);
}
}
private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
{
for (int i = 0; i < 5; i++)
{
if (l[i] == true)
{
checkedListBox1.Items.Remove(i);
}
}
}
}
Is there anybody who knows how to fix it? Thanks in advance.