471,348 Members | 1,335 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

invoking method from dataGridView1_CellClick with passthru to CellDoubleClick

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.ColumnInd ex);
} else
{
Form2 f = new Form2();
f.Show();
}
}
Feb 14 '06 #1
1 5150
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.DataGridViewCellMouseEventHan dler(this.dataGridView1_RowHeaderMouseClick);

"hazz" <ha**@sonic.net> wrote in message
news:eW****************@TK2MSFTNGP14.phx.gbl...
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.ColumnInd ex);
} else
{
Form2 f = new Form2();
f.Show();
}
}

Feb 15 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Rafal 'Raf256' Maj | last post: by
reply views Thread by Yemi | last post: by
3 posts views Thread by Jerry | last post: by
2 posts views Thread by Greg Chapman | last post: by
2 posts views Thread by Martin Kofahl | last post: by
2 posts views Thread by Robertico | last post: by
1 post views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.