[RESOLVED] can u say how to set the precession as 1 to a "singel" type data type
Hi all!
i want to set the precession of a "single" variable to 1.. is is possible in v.b 6.0? if so , kindly tell me.
egg:
dim x as single
x=4.01234
msgbox(x) ' x shole be 4.0 only ......not 4.01234
so i want to round this.. how it is possible.......
thanks in advance
regards:
raghunadhs
Re: can u say how to set the precession as 1 to a "singel" type data type
vb Code:
Dim x As Single
x = 4.01234
MsgBox (Left(x, 1))
Does that help?
Re: can u say how to set the precession as 1 to a "singel" type data type
Hell-Lord, your suggestion would only work on numbers less then 10. I'd use:
Code:
Dim x As Single
x = 4.01234
MsgBox (Int(x))
Re: can u say how to set the precession as 1 to a "singel" type data type
Yes >.< should have thought of that thanks.
Also probably use CInt instead of Int but yea much better.
Re: can u say how to set the precession as 1 to a "singel" type data type
Thanks to all who replied to my question...........
Thanks for your immediate correspondence...
Regards:
raghunads.v
Quote:
Originally Posted by opus
Hell-Lord, your suggestion would only work on numbers less then 10. I'd use:
Code:
Dim x As Single
x = 4.01234
MsgBox (Int(x))
Re: can u say how to set the precession as 1 to a "singel" type data type
using the round function you can set to however many decimal places you want
vb Code:
x = 4.32322
x = Round(x, 1)' one decimal place
Re: can u say how to set the precession as 1 to a "singel" type data type
Hai WestConn1!
I want this type of function only.. thank u very much..
regards:
raghuandhs
Quote:
Originally Posted by westconn1
using the round function you can set to however many decimal places you want
vb Code:
x = 4.32322
x = Round(x, 1)' one decimal place