Keypres event does not work for me in web application form

Answered
0
0

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 must to post comments
Best Answer
0
0

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.

Attachment
  • You must to post comments
0
0
Thanks, with example I could understand how it works
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.