Public Class Form1 Private Sub dgv1_EditingControlShowing(ByVal sender As Object, ByVal e As DataGridViewEditingControlShowingEventArgs) Handles dgv1.EditingControlShowing If Me.dgv1.CurrentCell.ColumnIndex = 1 Then AddHandler e.Control.KeyPress, AddressOf Handel_Column1_KeyPress End If End Sub Private Sub Handel_Column1_KeyPress(ByVal sender As System.Windows.Forms.DataGridViewTextBoxEditingControl, ByVal e As KeyPressEventArgs) If dgv1.CurrentCell.ColumnIndex = 1 Dim valid_entry = "0123456789" + ChrW(Keys.Back) If valid_entry.Contains(e.KeyChar) Then e.Handled = False Else e.Handled = True End If End If End Sub End Class
Sunday, 22 September 2013
Accept Only Integer in specific DatagridView Column or Cell
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment