...

View Full Version : Only allowing certain types of input?



Rappa
10-24-2007, 04:55 AM
I totally dont remember how to do this:

I have some text boxes, which should only accept integers, but i cant remember how to give an error if the user enters a letter instead of a number.

and ideas?

its in C#

-rappa

Dunna
10-24-2007, 04:57 AM
Not sure about C#, but in C++ I would compare the hex value of each inputted character to make sure it fell inside the alphabets acceptable range. I could give you some pseudo code but I'm not that familiar with C#.

ez4me2c3d
10-24-2007, 05:09 AM
I don't even code in C#, and I found the answer. So many languages are the same, you just have to know what to look for.

http://msdn2.microsoft.com/en-us/library/58918ffs(VS.71).aspx
OR
http://www.thescarms.com/dotnet/IsNumeric.aspx

Some languages actually have methods like isString and isInteger



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum