C datagrid cellvalidating

The checks will be performed when the user leaves the cell with Enter, Tab or the Arrow Keys.

Problem: Everything is working fine but when the cursor is in the cell and the value is greater than 100 and the User presses the "X"-Button on the form (Close-Button) the Message still appears.

m_Sqlstr = "Select Distinct RFID, Prod_Code, Lot_No From Scan Stk Where Batch No = '" & str Batchno & "' " m_Sql Cmd = New Sql Command(m_Sqlstr, Con) Con.

c datagrid cellvalidating-30c datagrid cellvalidating-68

I have individual cell validation working when the user edits the cell it calls my cell validating event.

But, I can't get it to validate all cells when a button is pressed.

I have two Data Grid View Textbox Column in my Form.

I want to compare one textbox with another textbox value.

What you have to do instead is change the value in the editing control (remembering not to cancel the event).

For example, for a Your response was great and saved me lots of time.

I am able to validate my value properly but when I try to change it to something valid I get a Data Error. You should never attempt to change the cell value in the handler for this event, because unless you cancel the event (in which case the user is stuck in edit mode), the cell value is set to the value from the editing control immediately after the event finishes.

This, therefore, undoes any action you perform in the handler.

Question: How can I prevent the appearance of the Message Box when the User is clicking on the X-Button on the form?

Code Samples: Well, if the user clicked on "X" I do not want to validate that value anymore .

Is there a way to change the dgv cell Style Format and cell Tag from within the Cell Validating event?

Tags: , ,