Hi guys I'm just starting with C#. I gotta do this for my project and have a hard time doing it.
I've gotta prevent people from entering numbers in my textbox of the program so they don't spoil it but I can't find anything that could do it. Anyone has any idea how? Tell my please thank you!!!

Techy Wizard10 reputationPosted Jul 23, 2008, 11:52 PM EDT
You can use the Masked Textbox control. Set the mask property to '?'.
Sivangari Vytheswaran110 reputationPosted Jul 23, 2008, 11:52 PM EDT
Hi
using Onkeypress event ,u can solve ur problem.
write the code in java script
1.First find the keyboard event code.
var key=e.keycode;
2.convert to this code to char and compare this char with ur string(if u give integers in this string ,u allow integer only.otherwise if u give a to z,u allow only char)
3.if condition satisfy, return true,otherwise return false.
4.above funtion called in textbox onkeypress event.
Niradhip ChakrabortyRank #429 · 5.8K reputationPosted Jul 24, 2008, 12:52 AM EDT
Call this javascript function on onkeypress of textbox.
function isNumberKey(evt){
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57)){
alert("Please enter digits");
return false;
}
else{
return true;
}
}
Ryan AlfordRank #1,411 · 1.2K reputationPosted Jul 24, 2008, 5:28 AM EDT