Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 Datagridview - replace a keypress with another key

$
0
0
Code:

Private Sub dgv_WorkHistory_EditingControlShowing(sender As System.Object, e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles dgv_WorkHistory.EditingControlShowing

        RemoveHandler e.Control.KeyDown, AddressOf cell_KeyDown
        AddHandler e.Control.KeyDown, AddressOf cell_KeyDown
     
End Sub


Private Sub cell_KeyDown(sender As Object, e As KeyEventArgs)

        If dgv_WorkHistory.CurrentCell.ColumnIndex = 3 Then
            If Not IsNumeric(e.KeyCode.ToString()) Then
                e.Handled = True  'if non numeric don't display
              'now replace with another key to display
            Else
                e.Handled = False
            End If
        End If

End Sub

Is this the right way to go about it? How would I write that (where I've highlighted in red)?

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>