Label showing number of chars left in a text box

A

Adam Thwaites

I want to make a label next to a text box count down the number of character
space left in the text box that updates real time. I'v made the code below
but I can't find a correct event to make it refresh with every keypress

Private Sub txtNotes_KeyUp(KeyCode As Integer, Shift As Integer)
Dim Length As String
Length = 255 - Len(txtNotes.Value)
lblLeftNotes.Caption = "(" & Length & ")"
End Sub
 
D

Dennis

Put it in the On Change event instead and change the code to this

Dim Length As Integer
Length = 255 - Len(txtNotes.Text)
lblLeftNotes.Caption = "(" & Length & ")"
 
Top