Results 1 to 3 of 3

Thread: [RESOLVED] Custom String Format

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Location
    Perth, Australia
    Posts
    101

    Resolved [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

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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:

    Code:
    LLL000
    Code:
    LLL000-000
    Hope this helps!!!

    Gary

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Location
    Perth, Australia
    Posts
    101

    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
  •  



Click Here to Expand Forum to Full Width