Serialcoder en Français Serialcoder in English
TEL : +33 (0)9 72 13 15 17

Windows Forms FAQ resources

12. Windows Forms from MFC

12.4 How do I convert a string to a double or int? What plays the role of atof and atoi in C#?


You use static members of the Convert class found in the System namespace to handle conversions in the .NET framework.

     string s = "45";
     int h = Convert.ToInt32(s);
     double d = Convert.ToDouble(s);