|
-
Jun 27th, 2001, 10:07 AM
#1
Thread Starter
Hyperactive Member
Limit number of characters in a textbox
What is the best way to do this?
I tried:
Code:
if len(txtTextBox) > 10 then
txtTextBox.Text = left(txtTextBox,10)
End If
But It places the cursor at the beginning of the text box, screwing up the text if the user continues to type and didn't notice...
Any ideas?
-
Jun 27th, 2001, 10:12 AM
#2
Fanatic Member
In the textbox properties you can set the MaxLength.
cheers
Ray
-
Jun 27th, 2001, 10:13 AM
#3
VB Code:
If Len(txtTextBox) > 10 Then
txtTextBox.Text = Left(txtTextBox, 10)
txtTextBox.SelStart = Len(txtTextBox)
End If
-
Jun 27th, 2001, 10:14 AM
#4
DOH!!
I forgot about MaxLength.
-
Jun 27th, 2001, 10:15 AM
#5
Thread Starter
Hyperactive Member
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
|