nicholasting
Programmer
i'm using datagrid view to display some records that query from database.
[Product Name], [Qty On Hand]
the column [Qty On Hand] is a numeric column. in the grid i allow user to imediate change any numeric value as they wish. but if use key in character, the system return error. i was trying to use CellValidating but still unable to validate the data key in. what is the event to use to check whether the data key in is a numeric?
i coded as below, but not work:
Private Sub dgdProduct_CellValidating(...)...
If Not IsNumeric(dgdProduct.CurrentRow.Cells("QTY").Value) Then
dgdProduct.CurrentRow.Cells("QTY").Value = 0
End If
End Sub
the propertise CurrentRow.Cells("QTY") is still holding the data before i edited.
if i use dgdCSBarcode_CellLeave, the system already return system error message before go into this event.
thanks for comments.
regards,
nic
[Product Name], [Qty On Hand]
the column [Qty On Hand] is a numeric column. in the grid i allow user to imediate change any numeric value as they wish. but if use key in character, the system return error. i was trying to use CellValidating but still unable to validate the data key in. what is the event to use to check whether the data key in is a numeric?
i coded as below, but not work:
Private Sub dgdProduct_CellValidating(...)...
If Not IsNumeric(dgdProduct.CurrentRow.Cells("QTY").Value) Then
dgdProduct.CurrentRow.Cells("QTY").Value = 0
End If
End Sub
the propertise CurrentRow.Cells("QTY") is still holding the data before i edited.
if i use dgdCSBarcode_CellLeave, the system already return system error message before go into this event.
thanks for comments.
regards,
nic