VB 每分钟写入一个数据到 TXT 文本。数据出现丢失
VB 写了个程序,说白了每分钟写入一个数据到TXT文本。在最后统计的时候发现数据出现丢失。要怎么解决。。。还有就是有时候会突然不写入数据了。数据为单片机传入的一个脚位状态信号。信号没问题,因为有另一个程序读取时正常的。
小弟初接触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