ColumnHeaderMouseDoubleClick event
-
I have a DataGridView on a windows form. If a user clicks on a cell, a property gets the current row and then populates data in another form. When a cell is highlighted, if a user double clicks on the columnheaders the modal form loads with the data from the highlighted row. I want to stop users from being able to double click on the column headers. Does anyone have any suggestions on how I could do this? Thanks, Taylor
-
I have a DataGridView on a windows form. If a user clicks on a cell, a property gets the current row and then populates data in another form. When a cell is highlighted, if a user double clicks on the columnheaders the modal form loads with the data from the highlighted row. I want to stop users from being able to double click on the column headers. Does anyone have any suggestions on how I could do this? Thanks, Taylor
Your question is not very clear to me. If you want to do something when you double click on a cell (and avoid doing anything if the user double clik on the header) you can do something like this, private void gvList_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int miHitRow = Convert.ToInt32(e.RowIndex); if (miHitRow < 0) return; //your code }