Click here to Skip to main content
14,826,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to get the location of the selected cells in data gridview.
I want to fill the selected cells with color using Lable but i cant get the location. plz show the way to get it..


1 solution

it is very simple, processing EventHandler DataGridView_CellContentDoubleClick(...) or ataGridView_CellContentClick(...)

try this code

private void DataGridView_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
int i = e.ColumnIndex;
int j = e.RowIndex

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