Hello
I have a windows form with the following code:
PublicClass Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
PublicSubNew()
MyBase.New()
InitializeComponent()
AddHandler Label1.KeyPress, AddressOf myKeyCounter
EndSub
ProtectedOverloadsOverridesSub Dispose(ByVal disposing AsBoolean)
If disposing Then
IfNot (components IsNothing) Then
components.Dispose()
EndIf
EndIf
MyBase.Dispose(disposing)
EndSub
#EndRegion
PrivatebackspacePressed AsLong = 0
PrivateSub myKeyCounter(ByVal sender AsObject, ByVal ex As KeyPressEventArgs)
SelectCase ex.KeyChar
Case ControlChars.Back
backspacePressed = backspacePressed + 1
EndSelect
Me.Label1.Text = backspacePressed & " backspaces pressed"
ex.Handled = True
EndSub
EndClass
Whenever i run the project though and click the backspace i see no changes to the label's text. How can i get this to work?
Thank you
I have a windows form with the following code:
PublicClass Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
PublicSubNew()
MyBase.New()
InitializeComponent()
AddHandler Label1.KeyPress, AddressOf myKeyCounter
EndSub
ProtectedOverloadsOverridesSub Dispose(ByVal disposing AsBoolean)
If disposing Then
IfNot (components IsNothing) Then
components.Dispose()
EndIf
EndIf
MyBase.Dispose(disposing)
EndSub
#EndRegion
PrivatebackspacePressed AsLong = 0
PrivateSub myKeyCounter(ByVal sender AsObject, ByVal ex As KeyPressEventArgs)
SelectCase ex.KeyChar
Case ControlChars.Back
backspacePressed = backspacePressed + 1
EndSelect
Me.Label1.Text = backspacePressed & " backspaces pressed"
ex.Handled = True
EndSub
EndClass
Whenever i run the project though and click the backspace i see no changes to the label's text. How can i get this to work?
Thank you