lundi 10 décembre 2018

How to check all checkbox by pressing one?

I want to make a code by selecting a checkbox from the ListView to automatically select all the checkbox from the ListView.

I'm using visual studio 2005 so I don't have ItemChecked form. Thats why I want to make this by using ListView itemcheck event. Here is my code.

enter image description here

private void lvBase_ItemCheck_1(object sender, ItemCheckEventArgs e)
{

    if ( ) // If selecting one checkbox from the ListView
    {
        for (int i = 0; i < lvBase.Items.Count; i++)
        {
         // Select all checkbox from the ListView
         }
     }
     else // If unselecting one checkbox from the ListView
     {
        for (int i = 0; i < lvBase.Items.Count; i++)
        {
         // Unselect all checkbox from the ListView
         }
     } 
}

Can you help me to fill this out? Or if you have any better idea please share :)




Aucun commentaire:

Enregistrer un commentaire