invoking method from dataGridView1_CellClick with passthru to CellDoubleClick

H

hazz

how do I call a method from CellClick if a user performs a single click on a
datagridview row and the same time allowing a double click event to be
passed onto CellDoubleClick if the user performs a double click action? As
it is now, the CellClick traps the single click event but does not allow a
double click to pass through to the CellDoubleClick event.
I do have to call a method from the CellClick event so I can't remove that
method.
Thanks, -hazz

private void dataGridView1_CellClick(object sender,DataGridViewCellEventArgs
e)
{
bSingleCellClick = true;
foo (arg1);
}
private void dataGridView1_CellDoubleClick(object sender,
DataGridViewCellEventArgs e)
{
if (bSingleCellClick)
{
ShowCustomerID(dataGridView1.CurrentCell.ColumnIndex);
} else
{
Form2 f = new Form2();
f.Show();
}
}
 
H

hazz

I had to use RowHeaderMouseClick and CellDoubleClick as below to get the
separation of click and doubleclick actions.
this.dataGridView1.CellDoubleClick += new
System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellDoubleClick);

this.dataGridView1.RowHeaderMouseClick += new
System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridView1_RowHeaderMouseClick);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top