Adding a select all shortcut (Ctrl + A) to a .net listview?

You could accomplish both with something like this:

private void listView1_KeyDown(object sender, KeyEventArgs e)
{
    if (e.KeyCode == Keys.A && e.Control)
    {
        listView1.MultiSelect = true;
        foreach (ListViewItem item in listView1.Items)
        {
            item.Selected = true;
        }
    }
}

Leave a Comment