Validate value as int32
-
I'm writing a console app that when the user types in a number it gets stored into an arraylist. When they type in certain commands it does misc. things, therefore the input is set to string. However if they type an invalid string that is not one of the preset commands or an integer I want to give them an error message. The issue I'm running into is checking wether the string is an integer or not. If someone can point me into the right direction I would appreciate it. Thanks in advance. :> To see one's self from another's point of view is an opportunity not to be passed up.
-
I'm writing a console app that when the user types in a number it gets stored into an arraylist. When they type in certain commands it does misc. things, therefore the input is set to string. However if they type an invalid string that is not one of the preset commands or an integer I want to give them an error message. The issue I'm running into is checking wether the string is an integer or not. If someone can point me into the right direction I would appreciate it. Thanks in advance. :> To see one's self from another's point of view is an opportunity not to be passed up.
Try using Int32.Parse() This function converts a string into a Int32 type. You can find more info in Help Free your mind...