Do While .PortOpen = True
BUFFER$ = BUFFER$ + .Input
DoEvents
If InStr(BUFFER$, "GPRMC") Then
Txt.Text = BUFFER$
str1 = Left(BUFFER$, InStr(BUFFER$, "$GPGGA"))
str2 = Left(str1, InStr(str1, "$"))
Txt.Text = str2
If Not str1 = "" Then
a = Split(str1, ",")
If UBound(a) > 9 Then
temp = a(0)
time.Text = GetTime(temp)
temp = a(2)
latitude.Text = GetLatitude(temp)
latitude1.Text = a(3)
temp = a(4)
longtitude.Text = GetLongtitude(temp)
longtitude1.Text = a(5)
End If
End If
BUFFER$ = ""
End If
Private Declare Function GetCurrentProcess Lib "kernel32" Alias "GetCurrentProcess" () As Long
Private Declare Function TerminateProcess Lib "kernel32" Alias "TerminateProcess" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long