|
-
Oct 16th, 2008, 11:28 PM
#1
Thread Starter
Lively Member
[RESOLVED] Custom String Format
Hi all,
I am not sure if the title best describes what I want achieve. I have a text box, and I either want it to be in the format of "AAA111" or "AAA111-111" Is there a function I can use to check the user input against the required format?
Thanks
Brent
-
Oct 16th, 2008, 11:38 PM
#2
Re: Custom String Format
Hey,
There are a number of ways you could do this. For instance, you could use a regular expression to validate the input to ensure that it matches the required format.
Or, if you are using VS 2005, then you might want to look into the MaskedTextBox. You can set the Mask property to match the format that you would like.
Here are some links:
http://msdn.microsoft.com/en-us/libr...edtextbox.aspx
http://msdn.microsoft.com/en-us/libr...tbox.mask.aspx
For instance, assuming all the values are required in the above examples, you could use the following masks:
Hope this helps!!!
Gary
-
Oct 17th, 2008, 12:32 AM
#3
Thread Starter
Lively Member
Re: Custom String Format
Hi Gary,
Thanks - That is just what I was looking for!!
Brent
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
|