Private Sub DataGridView1_EditingControlShowing(ByVal sender As Object _
, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) _
Handles DataGridView2_Edit.EditingControlShowing
Select Case DataGridView2_Edit.CurrentCell.ColumnIndex
Case Is = 3, 4, 5, 6, 7, 8
AddHandler CType(e.Control, TextBox).KeyPress, AddressOf TextBox_keyPress
End Select
End Sub
Private Sub TextBox_keyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs)
If e.KeyChar <> ControlChars.Back Then
e.Handled = Not (Char.IsDigit(e.KeyChar) Or e.KeyChar = ".")
End If
End Sub
Wednesday, December 6, 2017
กำหนด DataGridView ให้สามารถป้อนค่าตัวเลข, จุดทศนิยม เท่านั้น
Labels:
DataGridView
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment