|
-
Jan 3rd, 2009, 06:19 AM
#1
Thread Starter
Junior Member
[2008] only numerical values in textbox
Hi all
in my application there are many textboxes for amount, percentage etc. how can i limit the user to to enter only numerical values in such textboxes.
-
Jan 3rd, 2009, 06:28 AM
#2
Junior Member
Re: [2008] only numerical values in textbox
input should store in string variable . Then use TRYparse(vb 2005) fucntion to know input is integer or not. This fucntion will convert value to inetegr. if there is not integer then show message. Try
-
Jan 3rd, 2009, 06:31 AM
#3
Re: [2008] only numerical values in textbox
This is a very common question. You should search the forum, which you should always do before posting.
-
Jan 3rd, 2009, 07:23 AM
#4
Frenzied Member
Re: [2008] only numerical values in textbox
Since you are using VS2008 try using a MaskedTextBox control. It should prevent the user from entering non-numerical characters (or any characters not matching the mask).
Please rate helpful ppl's posts. It's the best 'thank you' you can give 
-
Jan 3rd, 2009, 07:35 AM
#5
Thread Starter
Junior Member
Re: [2008] only numerical values in textbox
 Originally Posted by obi1kenobi
Since you are using VS2008 try using a MaskedTextBox control. It should prevent the user from entering non-numerical characters (or any characters not matching the mask).
i can not use masked textbox control because it limits the number of digits
-
Jan 3rd, 2009, 08:27 AM
#6
Frenzied Member
Re: [2008] only numerical values in textbox
Well I don't have a lot of experience with MaskedTextBoxes, so I can't say if that problem can be solved... But I would advise you to consider using NumericUpDown controls since their return type is Decimal (I think).
Please rate helpful ppl's posts. It's the best 'thank you' you can give 
-
Jan 5th, 2009, 10:15 AM
#7
Re: [2008] only numerical values in textbox
How about using a NumericUpDown for this? It's not like it was made for this or anything.
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
|