Hello
I don't know where the Problem is but i can't connect to COM1 with VB.Net
With Hyperterminal i can connect so the port insn't in use.
Can you help me correcting this code?
Thank you vbcom
PS: Full Code in Attachment
View attachment snowinfo.txt
I don't know where the Problem is but i can't connect to COM1 with VB.Net
With Hyperterminal i can connect so the port insn't in use.
Can you help me correcting this code?
Thank you vbcom
PS: Full Code in Attachment
VB.NET:
Private Sub SendData()
On Error GoTo hilfe
Dim tmp(9) As String
tmp(0) = temp_da
tmp(1) = temp_j
tmp(2) = sh_da
tmp(3) = sh_j
tmp(4) = fsh_da
tmp(5) = fsh_j
tmp(6) = zeit
tmp(7) = datum
tmp(8) = jahr
Dim COM As New Ports.SerialPort
With COM
.PortName = "COM1"
.BaudRate = 9600
.DataBits = 8
.StopBits = Ports.StopBits.One
.Parity = Ports.Parity.None
.ReadTimeout = 10000
.WriteTimeout = 10000
End With
COM.Open()
Dim errnum As Integer = 0
retry:
COM.Write("*")
Dim i As Integer = 0
While i <= 8
If COM.ReadByte().ToString = "a" Then
COM.Write(tmp(i))
Else
COM.Write("eeee")
errnum = errnum + 1
If errnum < 3 Then
GoTo retry
Else
GoTo hilfe
End If
End If
i = i + 1
End While
If COM.IsOpen Then COM.Close()
Threading.Thread.Sleep(2000)
COM.Dispose()
Threading.Thread.Sleep(2000)
Return
hilfe:
Call mail(ErrorToString)
Return
End Sub
View attachment snowinfo.txt