jdidi
jdidi

Reputation: 159

C# listview itemcheck or itemchecked event

I have a listview with first column as checkbox for each item.

I wanted to add an itemcheck or itemchecked event when the user tick a box that trigger fires.

I have added to my code:

private void ListView1_ItemCheck1(object sender, 
System.Windows.Forms.ItemCheckEventArgs e)
{
  MessageBox.Show("has been checked");
}

For some reason, the event does not seem to be triggering.

Also, I found out that private void listView1_SelectedIndexChanged works when you click on one of the list items (as if you're selecting)

Have you come across this issue?

Upvotes: 0

Views: 3200

Answers (1)

jdidi
jdidi

Reputation: 159

I have answered my own question, I have added this:

this.listView1.ItemCheck += new ItemCheckEventHandler(listView1_ItemCheck);

and worked like magic.

Upvotes: 1

Related Questions