Click event getting lost during ColumnChanging event if modal dial

G

Guest

Click event getting lost during ColumnChanging event if modal dialog displayed
I am using VS2005
I have a situation as follows:

I have a handler for DataColumnChangeEvent ColumnChanging.
Inside this event it is some times necessary to pop up a modal dialog to get
missing information.

If the ColumnChanging event occurs because the user clicked a button on the
form (to close the form) the ColumnChanging event fires ok and the modal
dialog pops up but the click event from the button never fires.

I have a small program that demonstrates the problem.
 
L

Linda Liu [MSFT]

Hi EqDev,
If the ColumnChanging event occurs because the user clicked a button on
the form (to close the form) the ColumnChanging event fires ok and the
modal dialog pops up but the click event from the button never fires.

Since you have said "the ColumnChanging event occurs because the user
clicked a button on the form", what do you mean by "the click event from
the button never fires"?
I have a small program that demonstrates the problem.

Would you please send me your sample project for research? To get my actual
email address, remove the "online" from my displayed email address.

I look forward to your reply.


Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

I see what is happening.
It appears that the button is never getting focus because the focus I taken
by the modal dialog.
 
L

Linda Liu [MSFT]

Hi EqDev,

Thanks for sending me your sample project and I understand the problem now.

If you modify the value of a cell in the DataGridView and then move the
cursor out of the cell, i.e. move the cursor to another cell or click on
the button1, the DataGridView applies the pending change to the underlying
data source. This will raise the DataTable's ColumnChanging event. If you
make the cursor leave the cell by clicking on the button1, the Click event
of the button1 should be raised generally.

However, in your scenario, you displayed a modal dialog in the DataTable's
ColumnChanging event handler. Once a modal dialog is shown, any operation
on the parent form is disabled. Thus, the button1's Click event won't be
raised in this instance.

If you show the dialog modeless in the DataTable's ColumnChanging event
handler, the button1's Click event will be always raised, when you modify
the value of a cell and then click on the button1.

Hope this helps.
If you have anything unclear, please feel free to let me know.


Sincerely,
Linda Liu
Microsoft Online Community Support
 
L

Linda Liu [MSFT]

Hi EqDev,

How about the problem now? If you have any questions, please feel free to
tell me.

Thank you for using our MSDN Managed Newsgroup Support Service!


Sincerely,
Linda Liu
Microsoft Online Community Support
 

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