|
-
Jan 4th, 2010, 04:28 PM
#1
Thread Starter
New Member
Error in event handling in CF 3.5
HI!
I have a big problem with event handling in VS 2008. I'm writing a GPS program which determine the coordinates, attitude, speed etc. This is a part of a compass program. I'm using the Microsoft's GPS Intermediate Driver. I also use thread to the GPS reading from serial port to not interferre with the UI and the compass because the serial port reading is very slow and stops the compass' spinning for a second at every reading. I was ran through tons of forums and examples about the threads and event handling, but whenever I start the program and the event rises I get this error message:
NotSupportedException
Microsoft.AGL.Common.MISC.HandleArr(PAL_ERROR ar)
System.Windows.Forms.Control.get_Text()
System.Windows.Forms.Control.set_Text(String value)
O2Compass_VB.Form1._Lambda$__1(Object a0, LocationChangeEventArgs a1)
Microsoft.WindowsMobile.Samples.Location.GPS.WaitForGpsEvents()
The code is the next:
Code:
Imports Microsoft.WindowsMobile.Samples.Location
Imports System.Threading
Dim LatRef, LonRef As String
Dim WithEvents GPS As New Gps
'Start GPS readings
GPS.Open()
'Start thread
Dim GPSThread = New Thread(AddressOf GPSDataWriteOut)
GPSThread.Start()
Private Sub GPSDataWriteOut() Handles GPS.LocationChanged
If GPS.GetPosition.Latitude < 0 Then LatRef = "S" Else LatRef = "N"
If GPS.GetPosition.Longitude < 0 Then LonRef = "W" Else LonRef = "E"
If GPS.GetPosition.LatitudeValid Then LatTXT.Text = "Lattitude: " + GPS.GetPosition.Latitude.ToString("#0.0000000") + " " + LatRef
If GPS.GetPosition.LongitudeValid Then LongTXT.Text = "Longitude: " + GPS.GetPosition.Longitude.ToString("#0.0000000") + " " + LonRef
If GPS.GetPosition.SeaLevelAltitudeValid Then AltTXT.Text = "Altitude: " + GPS.GetPosition.SeaLevelAltitude.ToString + " m"
If GPS.GetPosition.SpeedValid Then SpeedTXT.Text = "Speed: " + GPS.GetPosition.Speed.ToString
If (GPS.GetPosition.SatelliteCountValid) And (GPS.GetPosition.SatellitesInViewCountValid) Then SatsTXT.Text = "Sattelites: " + GPS.GetPosition.SatelliteCount.ToString + " / " + GPS.GetPosition.SatellitesInViewCount.ToString
End Sub
Anyone can help me to fix this error? I though the code was right, but always came the same error. What am I doing wrong?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|