Click here to Skip to main content
15,886,798 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to select multi row like selecting row by ctrl + row header click.

What I have tried:

C#
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

You need to handle the CellValueChanged event instead of CellClick .
For reference
DataGridView multi selection C#
 
Share this answer
 
Go to Properties

Choose



C#
public bool MultiSelect { get; set; }


MultiSelect = true and SelectionMode = cellSelect
 
Share this answer
 
v4

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900