Problem adding a keypress event handler in vb.net?

4815162342

New member
Hi guys, i'm a developer newbie, and i have a little problem in vb.net.

I want to add an keypress event handler in one of my vb.net applications. This is a sample of the code:

Private Sub frmNomenklaturi_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress


MsgBox("The following key was pressed on the keyboard " & e.KeyChar)


End Sub

This code doesn't work at all. The event is not registered. I've tried, Me.KeyPress and MyClass.KeyPress, doesn't work too. I've tried KeyDown and KeyUp events. Am i doing something wrong?

Tnx!
 
Back
Top