Submitted by admin on Friday, January 28, 2011 - 15:44.
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