I want allow only to enter numeric values in a textbox in C#. Can someone assist me on this. would be a great help.
kimbula...
-1
Newbie Poster
Recommended Answers
Jump to PostSink the KeyDown event for the text box and you can cancel key presses if the character typed is not a digit. In fact, the documentation example for Control.KeyDown does exactly what you …
Jump to Postkimbula last posted 2 years ago, hasn't responded to suggestions since. Why would (s)he care about suggestions now? My suggestion 2 years ago avoids all the try/catch logic because it is encapsulated in int.TryParse. (Still need error handling, but number handling is built into the numbers themselves. Seems dumb to …
Jump to PostHelp whom? The original poster is 3 years gone.
I certainly would be pissed at a control that didn't let me use the arrow keys, the backspace key, the delete key. Those are part and parcel of a numeric entry. What if the number is real? How about negative numbers?
…
Jump to PostHelp whom? The original poster is 3 years gone.
The original poster isn't the only person a thread might help, that's why we don't close threads after they reach a certain age.
It could be helpful for u if u had brain.
Malicious personal attacks will …
Jump to Posttheir only options when mouseless is to hold down the power key (not counted as a keyboard key) for a minute or bring up task manager (no personal clue how to do that without a mouse),
Control-Shift-Escape
All 20 Replies
Radical Edward
301
Posting Pro
ddanbe
2,724
Professional Procrastinator
Featured Poster
bbman
12
Junior Poster
Radical Edward
301
Posting Pro
Ap0ca1ypse
0
Light Poster
kimbula...
-1
Newbie Poster
kplcjl
17
Junior Poster
Ap0ca1ypse
0
Light Poster
jayeshsorathia
-1
Newbie Poster
nmaillet
commented:
It's a 2 year old post, and shameless self-promotion... tisk tisk.
-1
yousafc#
0
Junior Poster in Training
kplcjl
17
Junior Poster
danie93
0
Newbie Poster
kplcjl
17
Junior Poster
ddanbe
commented:
Good point!
+15
kplcjl
17
Junior Poster
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
kplcjl
commented:
Thanks, for how you handled both of us because we were both wrong in how we reacted. I later felt an idiot for reacting to a post.
+3
kplcjl
17
Junior Poster
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
kplcjl
17
Junior Poster
Momerath
1,327
Nearly a Senior Poster
Featured Poster
kplcjl
commented:
... without a mouse and trapped in a user control keypress validator that only allows numberics.
+3
kplcjl
17
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.