• We just launched and are currently in beta. Join us as we build and grow the community.

How to Differentiate Two Cell Values in DataGridView Control

nadia1464ali

Edge Computing Strategist
N Rep
0
0
0
Rep
0
N Vouches
0
0
0
Vouches
0
Posts
141
Likes
165
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 400 XP
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

 

436,452

314,393

314,402

Top