![]() |
#2
Artless2014-08-15 10:58
|
还有就是有时候会突然不写入数据了。数据为单片机传入的一个脚位状态信号。信号没问题,因为有另一个程序读取时正常的。
小弟初接触VB编程,请大侠们多多指教

If "&H" & TxtReceive = "&HF8" And "&H" & TxtReceiveF = "&HFE" Then
LBLIST.Caption = Time & "System Running" & Chr(13) & LBLIST.Caption
Open Database1 For Append As #1
str = "1, " & Format$(Now, "general date") & ", System Running ," & "run(s)," & runA & "," & " stop(s)," & stopA & ","
Print #1, str
Close #1
ElseIf "&H" & TxtReceive = "&HFE" And "&H" & TxtReceiveF = "&HF8" Then
LBLIST.Caption = Time & "System Stoping" & Chr(13) & LBLIST.Caption
Open Database1 For Append As #1
str = "-1, " & Format$(Now, "general date") & ", System Stoping ," & "run(s)," & runA & "," & " stop(s)," & stopA & ","
Print #1, str
Close #1
End If
LBLIST.Caption = Time & "System Running" & Chr(13) & LBLIST.Caption
Open Database1 For Append As #1
str = "1, " & Format$(Now, "general date") & ", System Running ," & "run(s)," & runA & "," & " stop(s)," & stopA & ","
Print #1, str
Close #1
ElseIf "&H" & TxtReceive = "&HFE" And "&H" & TxtReceiveF = "&HF8" Then
LBLIST.Caption = Time & "System Stoping" & Chr(13) & LBLIST.Caption
Open Database1 For Append As #1
str = "-1, " & Format$(Now, "general date") & ", System Stoping ," & "run(s)," & runA & "," & " stop(s)," & stopA & ","
Print #1, str
Close #1
End If