I have a datagrid getting its data from the database. This datagrid has a column named “Room number”.
I want to add content double click event so that when the user clicks on a specific room number database should be accessed and get the data related to that room number from database and display it on a separate form.
How to access this column by name that is “Room Number”?
private void dgMaster_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
{
}
You can get the value of room number by this… i assume here that your
room numbercolumn is of typeint.You can also use the
e.ColumnIndexbut first you have to check that your are on the right index of cell.