Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
i have textbox in my form and i want it take only numbers from 1 to 12 only and not any thong else...i am trying but iam not getting the logic for it
Posted 14-Nov-12 9:02am
Comments
Nelek at 14-Nov-12 16:24pm
   
Please don't think we can read minds or do astral projections to see your monitor. If you need help, the least you could do is to explain your problem in such a way, that the users of CP can understand it. Otherwise, nobody will be able to help you.
what have you tried?[^]

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You say you are trying, but show no evidence of it. You can use Char.IsNumeric and Char.IsControl in the key down event of a textbox to allow only numbers. You can then use int.TryParse to see if the number that you end up with is not in your range, and erase it if it is.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 481
1 Maciej Los 345
2 OriginalGriff 308
3 Yogesh Kumar Tyagi 304
4 Prakriti Goyal 200
0 OriginalGriff 6,367
1 Sergey Alexandrovich Kryukov 5,296
2 Maciej Los 3,384
3 Peter Leow 3,259
4 DamithSL 2,490


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 14 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100