We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How can you validate the datagrid when a menu is clicked?

Thread ID:

Created:

Updated:

Platform:

Replies:

2148 Dec 18,2002 09:12 AM Dec 19,2002 08:46 AM Windows Forms 2
loading
Tags: FAQ
PeterB
Asked On December 18, 2002 09:12 AM

I am putting data into cells that will be saved into an XML file. When you type data into a cell and leave the datagrid to go to another control, the Validate event is fired. However, if you type data into a cell and then choose a menu item on that form(eg. File-Save), the Validate event does not get fired and any data in that cell will not get written out since the cell is still in edit mode and not reflected in the dataset. Would anyone have any ideas how to detect leaving the datagrid to choose a menu item on the form? Thanks.

Oussax
Replied On December 19, 2002 04:55 AM

I didn't try this but it helped me in other case: private void myDataGrid_Leave(object sender, System.EventArgs e) { this.BindingContext[dataSet,"TABLENAME"].EndCurrentEdit(); this.BindingContext[dataSet,"TABLENAME"].EndCurrentEdit(); }

PeterB
Replied On December 19, 2002 08:46 AM

Thanks for the input but this did not work. The event does not seem to fire when going to a menu so the code will not execute. Any other ideas are welcome...

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;