Click here to Skip to main content
15,917,565 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I create a numeric textbox with backspace and Enter is working perfectly...?

Please help me ..

Thanks in Advance..
Posted
Updated 23-May-11 2:54am
v2
Comments
Steven.Pinto2000 23-May-11 8:33am    
Is it for windows or for web
Sergey Alexandrovich Kryukov 23-May-11 12:09pm    
Tag it! WPF, Forms, what?
--SA

You can override the existing textbox and then handle key events as you require.
See here[^] for an example.
 
Share this answer
 
Comments
Kim Togo 23-May-11 8:39am    
My 5. Good link with code samples.
Abhinav S 23-May-11 8:48am    
Thank you.
Sergey Alexandrovich Kryukov 23-May-11 12:12pm    
No, I think this is about AcceptsReturn. Please see my solution.
--SA
Abhinav S 23-May-11 13:24pm    
We have given the OP two options. Lets hope any one of the solutions help him.
Sergey Alexandrovich Kryukov 23-May-11 13:57pm    
Agree. My solution is not the alternative one; it's the understanding of the problem can be alternative as it all based on insufficient information. Either of our solutions my appear applicable, or both of them.
--SA
For options of processing Enter, look at System.Windows.Forms.TextBox.AcceptsReturn. There is a similar thing in WPF. There is not problem about backspace, it always should work. If not, show your code; you could have screw up, I don't know what.

[EDIT] Of course, AcceptReturn of true only makes practical sense when the value of Multiline property is true. Kim, thank you for this important note.

—SA
 
Share this answer
 
v2
Comments
Kim Togo 23-May-11 12:19pm    
My 5 for a good solution. I did not think about AcceptsReturn on the TextBox. But perhaps this is what OP wants.
And perhaps set AcceptsTab and Multiline to true ?
Sergey Alexandrovich Kryukov 23-May-11 12:56pm    
Thank you very much, Kim.
You're write about Multiline. Apparently I just failed to mention it. Thank you for this help -- I'll improve the answer and credit this improvement to you.
--SA
Abhinav S 23-May-11 13:25pm    
Good alternate. 5.
Sergey Alexandrovich Kryukov 23-May-11 13:58pm    
Thank you, Abhinav.
As to alternative, I just commented on it at your solution. That must be it.
--SA
Abhinav S 24-May-11 0:20am    
You are welcome.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900