Results 1 to 7 of 7

Thread: Limiting the characters in a masked textbox?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Posts
    16

    Limiting the characters in a masked textbox?

    Hello,

    How do i limit the amount of characters in a masked textbox? I can do it in a normal textbox but not in a masked textbox because there is no option to limit the size.

    Regards.

  2. #2
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: Limiting the characters in a masked textbox?

    Hi,

    You can find some good infomation here.
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

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

    Re: Limiting the characters in a masked textbox?

    Hey,

    The size would automatically be limited by the amount of characters that you put in your mask would it not?!?

    What sort of mask are you trying to create, and what mask have you already tried to use?

    Gary

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Posts
    16

    Re: Limiting the characters in a masked textbox?

    I just want to know how you would only allow the following in a masked textbox:

    numerics
    maximum amount of characters of 1

    Regards.

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

    Re: Limiting the characters in a masked textbox?

    Use a NumericUpDown Class

    http://msdn.microsoft.com/en-us/libr...ricupdown.aspx

    And set the maximum value to 9.

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

    Re: Limiting the characters in a masked textbox?

    Alternatively, use a MaskedTextBox with a mask of "9".

    That should do it.

    Gary

  7. #7
    Member Cyrax.NET's Avatar
    Join Date
    Feb 2007
    Posts
    54

    Re: Limiting the characters in a masked textbox?

    gep13 is right, just use the mask itself as the limiting factor....

    so in the mask field enter "9" if you want to only allow number or a space....but i think what your looking for is "0" so this forces user to enter a number and does NOT allow spaces.

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