Click here to Skip to main content
14,636,537 members
Rate this:
Please Sign up or sign in to vote.
See more:
I want to select multi row like selecting row by ctrl + row header click.

What I have tried:

private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            dataGridView1.MultiSelect = true;
            int inde = e.RowIndex;
            dataGridView1.Rows[inde].Selected = true;
           
        }
Posted
Updated 10-May-16 21:32pm
v2
Comments
Santosh Kokatnur 11-May-16 1:54am
   
Member 12242717 11-May-16 2:50am
   
That's not work for me... any another solution
Rate this:
Please Sign up or sign in to vote.

Solution 1

You need to handle the CellValueChanged event instead of CellClick .
For reference
DataGridView multi selection C#
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

Go to Properties

Choose



public bool MultiSelect { get; set; }


MultiSelect = true and SelectionMode = cellSelect
   
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100