Calculation not working correctly

Dottj

New member
Joined
Mar 21, 2013
Messages
3
Programming Experience
1-3
Could somebody please help me out with getting my calculation to work. What I am trying to do is, if textbox31 is a negative number then it needs to subject textbox31 from textbox1 to get a bigger negative number. If textbox 31 is a positive number then it needs to subtract textbox 1 from textbox31 to come come up with the answer which should be positive. I have tried the following code but it seems to only be doing the first part of the equation and not the second ie the answer is always negative. Some help with this would be greatly appreciated. Diane

If TextBox31.Text < 0 Then
Form1.TextBox1.Text = Val(TextBox1.Text) - Val(TextBox31.Text)
Else

Form1.TextBox1.Text = Val(TextBox31.Text) - Val(TextBox1.Text)
End If
 
Why use a TextBox when you have NumericUpDown control for this purpose?
 
Back
Top