|
-
Oct 16th, 2000, 02:01 PM
#1
Thread Starter
Hyperactive Member
I am looking for a good Character count Algorithm for Textbox. ie I have a textbox that I can only allow 200 Characters in it. I want to coun't down from 200 when someone types in the textbox. When they use Delete or Backspace and other char's that don't add to the textbox like the arrow keys and function keys I don't want the counter label to count them. I can create one but I was hoping someone would have it done. Yes I guess I am being lazy but I have very little time to get this project done for work and there are alot of other things I need to do. WA!@Wa! Wa! Sorry for the wine. If anyone can help I would appreciate it. Here is code I have now this may help you understand what I am doing. I set the label LblTotNumchr=200 on form load. As you see the code does not take into account the other keys that are not numbers or letters or spaces. It counts everything!
If KeyCode = vbKeyBack Then
Counter = LblTotNumchr.Caption + 1
LblTotNumchr.Caption = Counter
Exit Sub
End If
Counter = LblTotNumchr.Caption
Counter = Counter - 1
LblTotNumchr.Caption = Counter
LblTotNumchr.Refresh
Thanks Troy
[Edited by Troy Mac on 10-16-2000 at 03:03 PM]
-
Oct 16th, 2000, 02:21 PM
#2
Frenzied Member
How about someting simpler:
LblTotNumchr.Caption = 200 - Len(textfield)
-
Oct 16th, 2000, 02:27 PM
#3
Thread Starter
Hyperactive Member
Da! Boy do I feel dumb My mind is going in so many dierctions I can't beleive I didn't think of that. Thanks guys you just made my life easier!!
Troy
-
Oct 16th, 2000, 02:29 PM
#4
-
Oct 16th, 2000, 02:33 PM
#5
Frenzied Member
Yes, you did. And only a minute (or less) ahead of me
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|