blah blah blah is here! blah blah » Close

up0down
link

I am trying to get the value from a NumericUpDown control into a int to I can do some math with it, HOWEVER I keep getting errors that it is a Decimal, but when I do a Messagebox.show(numericUpDown.value.ToString()) I get it to show the actual number like 2 or 3. What I have done for the time being is Converted the NumericUpDown into a String and then do a int.Parse(String) to get that value into a int. This is very, very ugly coding and I would hope that there would be a better way then to go from a Decimal to string to int. Am I missing something here? I have tried to go straight form the numeric.value to a int but it gave me an error saying you cannot conevert the decimal to int.
thanks for any help.

last answered 2 years ago

1 answers

up0down
link

int i = (int)numericUpDown1.Value

up0down
link

You are beatiful, I don't care what the others say. :D Thank you very much madHatter.

This post was imported from csharpfriends, if you have a similiar question please ask it again.

All previous members have been migrated, hope you enjoy the new platform!

Feedback