I'm offended by stsuing's comments about VB6. I've created a large VB6 app without any major issues. Of course that's a discussion for another thread, on another day...
Stsuing does make a good point regarding the try/catch method vs. the isnumeric method. The original poster wants integers, not 'numerics'.
This isnumeric function allows for some strange behavior that must be accomodated in order to use it properly.
The following table highlights this.
Code:
Value IsNumeric Integer.Parse
100 True No Error
-50 True No Error
10.4 True Error
e4 False Error
2e4 True Error
The e represents scientific notation for numbers and is, therefore, a valid number.
In VB6, it's even worse. You can also use the 'd' character to represent scientific notation.
As you can see, the Integer.Parse method is more stringent which is probably what the original poster had in mind.
-George
Strong and bitter words indicate a weak cause. - Fortune cookie wisdom