FYI, I looked at existing postings and I did not find exactly what I needed.
I am using Visual Studio 2008 to write a C# Windows Forms program. I have a DataGridView object that displays data from a table. When a user clicks on a cell I want to be able to grab the contents of that cell.
How do get an action to take place whenever there is a click on any cell in the datagridview. If the user clicks on the same cell 5 times in a row, I want the action to happen five times.
I am not even sure what the name of the event handler would be.
I tried the following, but it didn't work.
This was the code on the FormName.cs file:
private void DATASOURCEDataGridView_CellContentClick(object sender,
DataGridViewCellEventArgs e)
{
MessageBox.Show("clicked");
}
This was the code on the FormName.Designer.cs File:
this.DATASOURCEDataGridView.CellContentClick +=
new System.Windows.Forms.DataGridViewCellEventHandler(
this.DATASOURCEDataGridView_CellContentClick);
Thanks for the help!