hi..
how to convert decimal +ve value to decimal -ve value in vb 6.0
eg: value in text box = 3 , then i want convert it to -3
can anyone help me..
thanks...:)
Printable View
hi..
how to convert decimal +ve value to decimal -ve value in vb 6.0
eg: value in text box = 3 , then i want convert it to -3
can anyone help me..
thanks...:)
textbox.text = val(textbox.text) * -1
in addition to Pasvorto's example, you could subtract the Val() from 0.
veNEG = 0 - ve
Easiest way to do it would be to just multiply the number by -1. if you multiply 500 by -1 you get -550 and if you multiply -500 by -1 you get 500. Probably the best way to do it.
Though in the example given by Pasvorto, if you are using the val() function dont! Use clng(), cint(), etc... insted as tehy are about three times as fast.