Y
yoavrofe
I'm trying to open a serial port on a CE device. This is a port used
by the GPS.
System.IO.Ports.SerialPort does not work, but OpenNETCF.IO.Serial.Port
does work. This happends only on a few models (QUE for example). Is
there something I'm missing?
Thanks!
Yoav.
I get:
" OpenNETCF.IO.Serial.Port opened
System.IO.Ports.SerialPort failed "
from the following code:
Sub test3()
Try
TextBox1.Text = ""
Dim s1 As OpenNETCF.IO.Serial.Port
'MsgBox("1")
Dim portSettings As
OpenNETCF.IO.Serial.DetailedPortSettings
portSettings = New OpenNETCF.IO.Serial.HandshakeNone()
'MsgBox("2")
s1 = New OpenNETCF.IO.Serial.Port("COM3:", portSettings)
'MsgBox("3")
s1.Open()
'MsgBox("4")
If s1.IsOpen Then
'MsgBox("5")
TextBox1.Text = "OpenNETCF.IO.Serial.Port opened" &
vbCrLf
s1.Close()
Else
'MsgBox("6")
TextBox1.Text = "OpenNETCF.IO.Serial.Port closed" &
vbCrLf
End If
Catch ex As Exception
'MsgBox("7")
TextBox1.Text = "OpenNETCF.IO.Serial.Port failed" & vbCrLf
End Try
'MsgBox("8")
'Exit Sub
Try
Dim s2 As New System.IO.Ports.SerialPort("COM1:")
s2.Open()
If s2.IsOpen Then TextBox1.Text &=
"System.IO.Ports.SerialPort OK" & vbCrLf : s2.Close()
Catch ex As Exception
TextBox1.Text &= "System.IO.Ports.SerialPort failed" &
vbCrLf
End Try
End Sub
by the GPS.
System.IO.Ports.SerialPort does not work, but OpenNETCF.IO.Serial.Port
does work. This happends only on a few models (QUE for example). Is
there something I'm missing?
Thanks!
Yoav.
I get:
" OpenNETCF.IO.Serial.Port opened
System.IO.Ports.SerialPort failed "
from the following code:
Sub test3()
Try
TextBox1.Text = ""
Dim s1 As OpenNETCF.IO.Serial.Port
'MsgBox("1")
Dim portSettings As
OpenNETCF.IO.Serial.DetailedPortSettings
portSettings = New OpenNETCF.IO.Serial.HandshakeNone()
'MsgBox("2")
s1 = New OpenNETCF.IO.Serial.Port("COM3:", portSettings)
'MsgBox("3")
s1.Open()
'MsgBox("4")
If s1.IsOpen Then
'MsgBox("5")
TextBox1.Text = "OpenNETCF.IO.Serial.Port opened" &
vbCrLf
s1.Close()
Else
'MsgBox("6")
TextBox1.Text = "OpenNETCF.IO.Serial.Port closed" &
vbCrLf
End If
Catch ex As Exception
'MsgBox("7")
TextBox1.Text = "OpenNETCF.IO.Serial.Port failed" & vbCrLf
End Try
'MsgBox("8")
'Exit Sub
Try
Dim s2 As New System.IO.Ports.SerialPort("COM1:")
s2.Open()
If s2.IsOpen Then TextBox1.Text &=
"System.IO.Ports.SerialPort OK" & vbCrLf : s2.Close()
Catch ex As Exception
TextBox1.Text &= "System.IO.Ports.SerialPort failed" &
vbCrLf
End Try
End Sub