|
-
Nov 3rd, 2003, 08:46 AM
#1
Thread Starter
Lively Member
TextBox length
Is there an easy way to limit the number of characters allowed in a textbox.
I know I can count characters but I am looking at something like format where I can specify the format which limits the number of characters. In the old days I used to do like '#######'(not in VB) and that will only allow the same number of characters.
Currently I am using Regex but this only returns an error, if i need a number it only returns an error without knowing whether the problem is the format or the length.
-
Nov 3rd, 2003, 11:04 AM
#2
Fanatic Member
Textbox1.MaxLength() = x, where x is the length that you want.
-
Nov 3rd, 2003, 11:04 AM
#3
Fanatic Member
You can also set this property in the designer.
-
Nov 3rd, 2003, 12:47 PM
#4
-
Nov 3rd, 2003, 02:19 PM
#5
Thread Starter
Lively Member
Thanks VBCrazyCoder, crazy me I discovered that I already used this in all my textboxes except the one I had problem with. Forgot all about the maxlength.
As regards the masked textboxes that will be good, example ###.## will accept number in that form and size.
-
Nov 4th, 2003, 10:54 AM
#6
Frenzied Member
I found a pure .NET masked text box here, but it was kinda buggy. So i spent a couple of hours fixing it up and adding in lots of extra code to handle the issues he didn't. But it might be good enough for you.
~Peter

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
|