Click to See Complete Forum and Search --> : numericUpDown system decimal to int value


Riven
October 18th, 2009, 10:26 PM
I am trying to use the numericUpDown section in windows forms. All I want to do right now is just set an int variable to the value from the user input box.

I tried doing this:

int number = numericUpDown1->Value;


But, it returns an error:

error C2440: 'initializing' : cannot convert from 'System::Decimal' to 'int'


Could someone explain how I could use the numericUpDown box value as an int?
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Never mind found the answer myself. All I needed to do was:

int number = (int)numericUpDown1->Value;

Cant believe I forgot about that. XD
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++