Hi,
I have a datagridview on my form.There is a column of roll no in the datagridview.
I want that whenever user presses anyother key than a number key(ex:1,2,3,4....)than immediately i should get a messagebox that only numbers allowed.
I have tried the below code on datagridView Cellvalidation event but its not working.
Please suggest on what event and how can i do such validation.
If GridView2.Item(2, GridView2.CurrentCell.RowIndex).Selected = True Then
If e.ColumnIndex = 3 Then
If Not IsNumeric(e.FormattedValue) Then
GridView2.Rows(e.RowIndex).ErrorText = _
"Please Insert only numbers."
e.Cancel = True
End If
End If
End If