Private Sub DtGrid_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles DtGrid.EditingControlShowing
Try
Dim TB As TextBox = DirectCast(e.Control, TextBox)
If DtGrid.CurrentCell.ColumnIndex = Ecol_Mark.Index Then
AddHandler TB.KeyPress, AddressOf TxtMark_KeyPress
Else
RemoveHandler TB.KeyPress, AddressOf TxtMark_KeyPress
RemoveHandler TB.KeyPress, AddressOf TxtMark_KeyPress
End If
Catch ex As Exception
End Try
End Sub
Private Sub TxtMark_KeyPress(ByVal Sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
e.KeyChar = 0
End Sub
Try This Code
[SM]: Formatted the code.