I have this code that I used in winform and I am trying to implement it in wisej.I have set keypreview to true to capture the event and when I test,capturing the event does not work.The event to capture is the enter, because I want to instead use the enter tab.
This is the code I am using in the form’s keypres event
If e.KeyChar = ControlChars.Cr Then
SendKeys.Send(“{TAB}”)
e.Handled = True ‘evita el pitido al pulsar Enter
ElseIf e.KeyChar = “‘” Then
e.Handled = True
ElseIf e.KeyChar = “|” Then
e.Handled = True
End If
in the Sub New
Public Sub New()
InitializeComponent()
AddHandler Me.KeyPress, AddressOf Me.FGEN_LOGIN_KeyPress
End Sub
You can add an event handler via the designer- the code will be auto-generated. Simply look at the form in the properties window, click on the lightning bolt to see events, and double-click on the “KeyPress” event.
Your code AddHandler Me.KeyPress, AddressOf Me.FGEN_LOGIN_KeyPress
also works to attach to the KeyPress event.
See attached sample.
Please login first to submit.