We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


Windows Form DataGridView - RowValidating Event Not Firing

Medium Priority
Last Modified: 2013-11-26
I'm Developing a Windows Forms application with a datagridview bound to a datasource. In the process of validating some cell values the RowValidating Event does not fire when navagation moves off the row. Works fine moving to Next Row. However, if i change a cell value, Tab back to the left to another cell on the same row, then use the mouse to click on a Previous row above the changed row..... the RowValidating Event does not occur.
   A B  C D
1 x  x  x  x
2 x  x  x  x
3 x  x  x  x

If I change the value in C2, then backtab (or mouse click) back to B2, Then mouse click on any cell in row 1, the RowValidation Event does not fire and thus the changed value in C2 does not get evaluated. I am manually handling the Datasource Update which is dependant on the validations. Please advise ...
Watch Question

Jorge PaulinoIT Pro/Developer
Top Expert 2008
That's a validation for the row, not for the cells. Use CellValidating event instead

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


Therein lies the initial problem. I am using CellValidating but if one cell is dependant on another I cannot navagate away from the invalid cell to change the parent cell controlling the validation logic. Example:
I have both a "Company" column and a "Division" Column. Both columns may have a valid entry for each independent cell but there are only certain valid "Divisions" for a given "Company". I was attempting to use Cell validation for the individual values and then apply RowValidating to ensure the validity of the group "Company and Division".  Otherwise,  a valid company and division would pass the first line of validations and allow the Update of an Invalid Company/Division combination.
I'm open to other approach to this kind of issue?
Jorge PaulinoIT Pro/Developer
Top Expert 2008

Can you show what you're doing ?
Let me diverge from the intial description to the REAL Issue.
  The idea revolves around a product ID column of an order detail line in a datagridview. I'd like the user to have the option of typing in the product ID or clicking a "Button" in the next column which would display another Gridview (like a Pop-Up) and allow the customer to select the product ID. The concept is to have a button column which the user could click if he/she input the wrong ID and select the Correct One.
   The problem, if the user inputs an invlaid Product ID, CellValidating Fires and prevents the user from navagating away and clicking the Button which would display the valid options to select from. I'm not sure how to handle the scenario so I tried using the RowValidating event for the Product ID to allow for the Button Selection. Sorry for the confusing description. Does what i'm attempting make sense?
Note-I'm using a second datagridview instead of a combobox column in my initial DGV because i what to provide more information for the user to have availble like description, price, Onhand qty, etc..
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.