Conversion from String to int

untwisted

New member
Joined
Jul 19, 2003
Messages
3
Location
Pittsburgh
Hi,

Im new to C#, and I was wondering how to convert from type string to type int so that I could preform math operations on my variables.

Thanks,
Brian
 
C#:
myNum = Int32.Parse(stringVar);
Note that you should put this inside a Try..Catch block, because that will raise an error if the input string is not a valid number.
 
AhhH! Much thanks! I knew I had read something about a .toInt or .Parse type method, but I couldnt find the page I had read it on!

-Brian
 
Back
Top