Capture Datagridview cell kepress event
vb.net
Solution
As per Fco Navarro's answer, except that using `e.Control` does not always work because `e` is passed in to the `EditingControlShowing` event `ByVal` meaning any changes to the control (eg changing the `.Text` property) are NOT reflected in the DataGridView. If you need to do anything with the actual TextBox control in your event handler, you can use `DataGridView1.EditingControl` instead of `e.Control`.
Private WithEvents txtNumeric As New DataGridViewTextBoxEditingControl
Private Sub DataGridView1_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles DataGridView1.EditingControlShowing
txtNumeric = CType(DataGridView1.EditingControl, DataGridViewTextBoxEditingControl)
End Sub
Private Sub txtNumeric_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs) Handles txtNumeric.KeyPress
txtNumeric.Text = txtNumeric.Text.ToUpper()
End Sub
Problem
Could any body kindly give me code example how to capture datagridview cell keypress event? Datagridview_keypress does not help. Thanks