Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Formating numbers


Message #1 by "Gonzalo Martin Bianchi" <gbianchi@a...> on Wed, 28 Aug 2002 13:38:15 -0300
Dim x as Double
Dim y as Double

     x = Val(Text1.Text)
     y = Int(x)
     If x > y Then y = y + 1

X has the input value
Y has the result  you seek.
I just tested this and it works well.   1 -> 1, 1.0000000001 -> 2,
1.9999999 -> 2



----- Original Message -----
From: "John Stendor" <john.stendor@c...>
To: "professional vb" <pro_vb@p...>
Sent: Wednesday, August 28, 2002 11:51 AM
Subject: [pro_vb] Re: Fw: Formating numbers


> 1.01 + .5 rounded will give you 2
> 1.60 + .5 rounded will give you 2
>
> HTH
>
> alo Martin Bianchi wrote:
> >
> > thanks for the reply, but im trying to round it up..
> >
> > i want something that can do this (without any if or iif):
> >
> > 1.01 = 2
> > 1.00 = 1
> > 1.60 = 2
> > 2.00 = 2
> > 0.09 = 1
> >
> > any math genius will work too :)
> >
> > Gonzalo Martin Bianchi
> > Desarrollo de sistemas de cuenta corriente tributaria
> > Hipolito Yrigoyen 370
> > Entrepiso B pasillo 600 oficina 5
> > 4347-3181
> > ----- Original Message -----
> > From: "Walt Morgan" <wmorgan@s...>
> > To: "professional vb" <pro_vb@p...>
> > Sent: Wednesday, August 28, 2002 1:49 PM
> > Subject: [pro_vb] Fw: Formating numbers
> >
> > > Gonzalo,
> > >
> > > You may wish to try the Round() function:
> > >
> > >     x = Round(1.01,0) will return 1 for example
> > >
> > > Walt
> > >
> > >
> > >
> > > ---
> > > Visual C# - A Guide for VB6 Developers
> > > This book will make it easy to transfer your skills
> > > from Visual Basic 6 to C#, the language of choice
> > > of the .NET Framework.
> > > http://www.wrox.com/ACON11.asp?ISBN=1861007175&p2p0059
> > >
> >
> > ---
> > Visual C# - A Guide for VB6 Developers
> > This book will make it easy to transfer your skills
> > from Visual Basic 6 to C#, the language of choice
> > of the .NET Framework.
> > http://www.wrox.com/ACON11.asp?ISBN=1861007175&p2p0059
> >
>
>
> ---
> Visual C# - A Guide for VB6 Developers
> This book will make it easy to transfer your skills
> from Visual Basic 6 to C#, the language of choice
> of the .NET Framework.
> http://www.wrox.com/ACON11.asp?ISBN=1861007175&p2p0059
>


  Return to Index