Getting the text in NumericUpDown

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi.
i have written this code to get the text in a NumericUpDown control:

nudQuestions.Text

and i start the application in debug mode and use the arrow keys that come
with the numeric up down control to set the number to be 2. but when i break
the process and view the value inside the control in Watch, it says that it
is "1".

how can i get its value correctly? thanks.
 
I think this is what you mean:

Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles NumericUpDown1.ValueChanged
TextBox1.Text = NumericUpDown1.Value
End Sub

When you break on the line 'NumericUpDown1.Value' the value won't increment
until you move to the next line of code. Therefore, your value will be 1
until the line of code below is reached because you've stopped it on the
line that hasn't executed yet

Crouchie1998
BA (HONS) MCP MCSE
 
Hi,

If you look at the nudQuestions.Value in the debugger it will show
1D for a value of 1. The D means it is of the decimal type.

Ken
 
hi,

i still have a problem: the Value property displays 1D whatever the number
in the control is. (i break the program at the line after the assignment.)

--
Xero

http://www.chezjeff.net
My personal web portal
 
Back
Top