I'm working in visual studio and trying to get information from a DataGridView cell when the user double clicks on it. I basically set up the CellDoubleClick event just like any other Click event but that doesn't seem to work.
Code:
Form1.cs
private void dataGridView1_CellDoubleClick(Object sender, DataGridViewCellEventArgs e)
{
System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "ColumnIndex", e.ColumnIndex);
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex);
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "CellDoubleClick Event");
}
Pertinent code in Form1.Designer.cs
this.dataGridView1.CellDoubleClick += new System.EventHandler(this.dataGridView1_CellDoubleClick);
I am getting an error in the Form1.Designer code that says, "No overload for 'dataGridView1_CellDoubleClick' matches delegate 'System.EventHandler'.
How can I get the double click to work correctly? Thanks.