|
-
Apr 23rd, 2007, 09:18 AM
#1
Thread Starter
New Member
[RESOLVED] convertion from +ve value to -ve value
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...
-
Apr 23rd, 2007, 09:23 AM
#2
PowerPoster
Re: convertion from +ve value to -ve value
textbox.text = val(textbox.text) * -1
===================================================
If your question has been answered, mark the thread as [RESOLVED]
-
Apr 23rd, 2007, 08:31 PM
#3
Addicted Member
Re: convertion from +ve value to -ve value
in addition to Pasvorto's example, you could subtract the Val() from 0.
veNEG = 0 - ve
Do not use if shrinkwrap is broken or missing!
I'm learning how to fish, too!
-
Apr 23rd, 2007, 08:40 PM
#4
New Member
Re: convertion from +ve value to -ve value
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|