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 =)

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

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

Glad it worked for you...

Chester

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.