Jussi, I've put the code below into the Fmain class in that Test project and it works OK! The Test project needs a lot more code in order to obtain the Latitude from the database. I'll check it out again with the full project.
Public Sub ValueBoxLongitude_KeyRelease() If Key.Code = Key.Return Or Key.Code = Key.Enter Or Key.Code = Key.Tab Then ButtonExit.SetFocus() Endif End 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 ButtonExit.SetFocus End Sub ------------------------------------------------------------------------------ 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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user