[Gambas-user] Check on entered number having more than 6 digits not working

Fabien Bodard gambas.fr at ...626...
Sat Aug 11 17:07:11 CEST 2012


If len(frac(latitude)) sup 8 then...
Le 11 août 2012 17:03, "Jussi Lahtinen" <jussi.lahtinen at ...626...> a écrit :

> I cannot reproduce your problem... What is your Gambas version?
>
> Jussi
>
>
>
> On 11 August 2012 17:51, John Rose <john.aaron.rose at ...626...> wrote:
>
> > I'm trying to validate an entered Latitude value as having a maximum of
> > 6 digits after the decimal point. Sometimes it doesn't work. In the case
> > below, it is 48.590278. This should be valid, but the
> > 'Message.Info("More than 6 decimal digits - try again")' line is being
> > executed. As you can see from the Print statements, the check should be
> > OK. Am I missing something really obvious?
> >
> > Public Sub ValueBoxLatitude_LostFocus()
> >   Dim latitude As Float
> >   Dim f As Float
> >   Dim g As Float
> >   If IsNull(Last.Value) Then Return
> >   latitude = Last.Value
> >   If latitude < -90 Or latitude > 90 Then
> >     Message.Info("Must be between -90 and +90 - try again")
> >     Last.SetFocus()
> >     Stop Event
> >   End If
> >   f = latitude * 1000000
> >   g = CFloat(CInt(f))
> >   Print "f=" & f
> >   Print "g=" & g
> >   If f <> g Then
> >     Message.Info("More than 6 decimal digits - try again")
> >     Last.SetFocus()
> >     Stop Event
> >   End If
> >
> > f=48590278
> > g=48590278
> >
> > --
> > Regards,
> > John
> > +44 1902 331266
> > +44 7894 211434
> >
> >
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's security and
> > threat landscape has changed and how IT managers can respond. Discussions
> > will include endpoint security, mobile security and the latest in malware
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list