+ 3

Convert Problem C#

(In C# Windows form application)how to convert numericupdown input to int?(vs2017)

29th Jul 2019, 11:33 AM
AmirHosseinHabibi
AmirHosseinHabibi - avatar
1 ответ
+ 2
If your numericUpDown.Value input has only whole numbers without decimal places then you can convert directly to int without rounding: Convert.ToInt32(numericUpDown1.Value); If your numericUpDown.Value input contains decimal places, and has to be rounded first in order to convert to int, use Math.Round: Convert.ToInt32(Math.Round(numericUpDown1.Value, 0));
29th Jul 2019, 1:43 PM
Jennifer Cramer
Jennifer Cramer - avatar