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. Image for the cookie policy date

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

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.

2 Replies

OU Oussax December 19, 2002 09:55 AM UTC

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(); }

PE PeterB December 19, 2002 01:46 PM UTC

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...
Loader.
Live Chat Icon For mobile
Up arrow icon