0

Private Sub txtMessage_KeyPress(ByVal sender As Object, ByVal vv As System.Windows.Forms.KeyPressEventArgs) Handles txtMessage.KeyPress

Dim tmdataleft As Integer
Dim addby As Integer = 1

If tmdataleft = 160 Then
vv.Handled = True
Else
tmdataleft = (tmdataleft + addby)
DataLeft.Text = tmdataleft
DataLeft.Update()
MsgBox(tmdataleft & " ELSE --- The Variable is less than 160")
End If
End Sub

well i have that for now, what I would like it to do is add(+1) for each letter/number typed into the box. and subtract 1 if the user backspaces, right now it just doesn't add at all.. if anyone could point me in the right direction i'd appreciate it =)

2
Contributors
3
Replies
4
Views
12 Years
Discussion Span
Last Post by cpopham
0

expression.length will give you the number of characters.

Dim intLetCount as integer

intLetCount = me.textbox.length

If intLetCount < 160 Then
     Do Something
Else
     Do Something Else
End If

Hope that helps.

Chester

0

That worked out very well! Sorry I didn't know about the code tag!
Thank you so much cpopham!!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.