DataTable Click Event
-
I have a DataGridView (called dgStandings) that has a datasource of a datatable (called dtLeader). I want to fire an event when someone double clicks a cell in the datagrid view and have a new window load with data depending on what cell is clicked. Unfortunately, none of the events I make (CellMouseDoubleClick,CellContentDoubleClick,CellMouseUp) ever fire an event. In fact, the events above only fire when I click/doubleclick on one of the header cells in dgStandings. So how can I fire an event when I doubleclick a cell in dgStandings?
-
I have a DataGridView (called dgStandings) that has a datasource of a datatable (called dtLeader). I want to fire an event when someone double clicks a cell in the datagrid view and have a new window load with data depending on what cell is clicked. Unfortunately, none of the events I make (CellMouseDoubleClick,CellContentDoubleClick,CellMouseUp) ever fire an event. In fact, the events above only fire when I click/doubleclick on one of the header cells in dgStandings. So how can I fire an event when I doubleclick a cell in dgStandings?
-
I have a DataGridView (called dgStandings) that has a datasource of a datatable (called dtLeader). I want to fire an event when someone double clicks a cell in the datagrid view and have a new window load with data depending on what cell is clicked. Unfortunately, none of the events I make (CellMouseDoubleClick,CellContentDoubleClick,CellMouseUp) ever fire an event. In fact, the events above only fire when I click/doubleclick on one of the header cells in dgStandings. So how can I fire an event when I doubleclick a cell in dgStandings?
hook to the DataGridView's CellDoubleClick event if selecting by row do a
foreach (DataGridViewRow row in this.dgStandings.SelectedRows) { goGetYourNewDataMethodWhichTakesAString(row.Cells[0].Value.ToString()); }
where the cell index is the cell you want or for multiple cellsforeach (DataGridViewCell cell in this.dgStandings.SelectedCells) { goGetYourNewDataMethodWhichTakesAStringcell.Value.ToString(); }
or even more simplygoGetYourNewDataMethodWhichTakesAString(this.dgStandings.SelectedCells[0].Value.ToString());