04-08-20, 02:19 PM
جرب هذا الكود :
https://stackoverflow.com/questions/1551...user-input
كود :
Private Sub DataGridView1_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs) Handles DataGridView1.EditingControlShowing
RemoveHandler e.Control.KeyPress, AddressOf EditingControl_KeyPress
AddHandler e.Control.KeyPress, AddressOf EditingControl_KeyPress
End Sub
Sub EditingControl_KeyPress(sender As Object, e As KeyPressEventArgs)
Dim editingControl As Control = sender
If DataGridView1.CurrentCell.ColumnIndex = 1 Then
If (Not Char.IsControl(e.KeyChar)) Then
If Not Regex.IsMatch(editingControl.Text + e.KeyChar, "^[-+]?\d*\.?\d*$") Then
e.Handled = True
End If
End If
End If
End Subhttps://stackoverflow.com/questions/1551...user-input

