Page 2 of 3

Re: Get value from NumericUpDown

PostPosted: Fri Jan 11, 2019 7:52 pm
by ger21
What is the error you are seeing?

Re: Get value from NumericUpDown

PostPosted: Fri Jan 11, 2019 8:06 pm
by Jeffsg605
I think you hit the main ones. That would be great.

So I assume there's no way to read in the value from a NumericUpDown yet?

Re: Get value from NumericUpDown

PostPosted: Fri Jan 11, 2019 8:30 pm
by Robertspark
Jeffsg605 wrote:So I assume there's no way to read in the value from a NumericUpDown yet?



give me a moment.... multitasking

Re: Get value from NumericUpDown

PostPosted: Fri Jan 11, 2019 8:55 pm
by Robertspark
Use one of these below (numericUpDown1.Value is actually a Decimal value)

Code: Select all
      double dblnumericUpDown1 = Convert.ToDouble(numericUpDown1.Value);
      string strnumericUpDown1 = Convert.ToString(numericUpDown1.Value);

Re: Get value from NumericUpDown

PostPosted: Fri Jan 11, 2019 9:25 pm
by dezsoe
You should save it in the ValueChanged event, I think.

Re: Get value from NumericUpDown

PostPosted: Fri Jan 11, 2019 9:28 pm
by Robertspark
dezsoe wrote:You should save it in the ValueChanged event, I think.


Not necessary, if you are using another event like within a button event..... Depends what your form does.... If you want the value to have instant effect on change then yes

Re: Get value from NumericUpDown

PostPosted: Sat Jan 12, 2019 2:24 pm
by Jeffsg605
Thank you guys. I'll try both methods. I could have sworn I tried the "Convert.ToDouble(...)" but it didn't work. Maybe I typed it wrong.

In any case, I'll be back at the machine on Monday. I'll let you know, thanks for all the help!

Re: Get value from NumericUpDown

PostPosted: Sat Jan 12, 2019 10:20 pm
by cncdrive
Things should work, because the UCCNC is using the .NET compiler called (CodeDom), so there is no way that C# functions like Convert.ToDouble is not working, because that would mean that the .NET framework is broken on the computer, but that is also not possible, because then the UCCNC itself would also not work, because it is a .NET application and run by the .Net framework. :)

Re: Get value from NumericUpDown

PostPosted: Sat Jan 12, 2019 10:22 pm
by Jeffsg605
That was my understanding, too. But then how come something like "double x = (double)NumericUpDown1.Value" doesn't work.

Re: Get value from NumericUpDown

PostPosted: Sat Jan 12, 2019 10:29 pm
by cncdrive
It should work. What is the error message you get?