Friends,
How Can i Validate to a User, That He Could Type Only Numeric Value in datagridviewtextboxcolumn, Please Suggest Me.......
Friends,
How Can i Validate to a User, That He Could Type Only Numeric Value in datagridviewtextboxcolumn, Please Suggest Me.......
Here's one way:
Private Sub DataGridView1_CellValueChanged(sender As Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellValueChanged
If e.RowIndex <> -1 Then
Dim CurrentCell As DataGridViewCell = DirectCast(sender, DataGridView).Rows(e.RowIndex).Cells(e.ColumnIndex)
If Not CurrentCell.Value Is Nothing Then
If e.ColumnIndex = 0 AndAlso Not Double.TryParse(CurrentCell.Value.ToString, vbNull) Then
MsgBox("Only Numbers Please")
CurrentCell.Value = Nothing
End If
End If
End If
End Sub
End Class
If this doesn't work for you, you'll have to be more specific in your question, and show the code you're having trouble with.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.