471,337 Members | 848 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

windows form event firing order

I would like to have control over datagridview events so that when a user
'single clicks' anywhere on the grid, a method call is made to a service and
if a user 'double clicks' a Customer detail form is launched.
The problem is that the RowEnter event keeps firing on the initialization of
the grid. I don't want to make Service Calls everytime this happens. I only
want the ServiceCall to be made after the grid is intialized and also not
have it be called when a user double clicks.

At the same time I only want the Customer form detail to be launched on a
double click event but not when a user only single clicks.

How can I code my app correctly to achieve this? My attempts at using a
boolean flags to control this failed because the RowEnter event gets called
multiple times and when I double click, the row event gets called and
without the right sentinel code, the service call would be made.

Thank you for your help! -hazz

private void InitGrid()
{
dataGridView1.DataSource = cl;
}

private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs
e)
{
Customer c = m_Customer;
ServiceCallToUpdateDatabaseWithCustomerFlag(c.Cust omerID);
}

private void dataGridView1_CellContentClick
{
Customer c = m_Customer;
FormCustomerDetail f = new FormCustomerDetail;
f.Show();
}
Feb 14 '06 #1
0 1489

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Susan Bricker | last post: by
8 posts views Thread by Jacek Jurkowski | last post: by
6 posts views Thread by Kevin Attard | last post: by
2 posts views Thread by John Kotuby | 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.