Skip to main content

How to Differentiate Two Cell Values in DataGridView Control

I read a lot of question about this on the forum and thought it’s time to share with you on how to differentiate two cell values in DataGridView control. By default we use the Value property of cells like: QtyOrdered = InvoiceDetails("Qty", e.RowIndex).Value Another is to use the FormattedValue like: QtyOrdered = InvoiceDetails("Qty ", e.RowIndex).FormattedValue But the two code above will not work if you have a condition like If QtyOrdered > InvoiceDetails ("TotalQty", e.RowIndex).Value Then to determine if the Qty Ordered is less than the Qty in your inventory. The solution to this problem is to use the EditedFormattedValue like: QtyOrdered = InvoiceDetails("Qty", e.RowIndex).EditedFormattedValue EditedFormattedValue property is useful if you want to differentiate the value using DataGridView. CellValidating Event

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.