VB 写了个程序,说白了每分钟写入一个数据到TXT文本。在最后统计的时候发现数据出现丢失。
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 展开
还有就是有时候会突然不写入数据了。文本内容不进行更新,重开软件又开始记录
数据为单片机传入的一个脚位状态信号。信号没问题,因为有另一个程序读取时正常的。
小弟初接触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 展开
2个回答
展开全部
从你代码中看~如果没写入数据到文本里 八成就是不满足if条件的要求 你完全可以在
if then
elseif then
else
'这里另外写一个写入log信息的代码,来观察除了2那个条件以外,什么时候程序不正常了 不正常的时候TxtReceiveF和TxtReceive 分别是多少的值,写入到log文本文件里
end if
if then
elseif then
else
'这里另外写一个写入log信息的代码,来观察除了2那个条件以外,什么时候程序不正常了 不正常的时候TxtReceiveF和TxtReceive 分别是多少的值,写入到log文本文件里
end if
更多追问追答
追问
之前有写了另外一个文本为没秒写入一次。那个文本与此文本对比发现数据是正常传达到了。只是不知道为什么未写入。所以想知道VB文本写入有什么限制或什么因素会影响
之前有写了另外一个文本为没秒写入一次。那个文本与此文本对比发现数据是正常传达到了。只是不知道为什么未写入。所以想知道VB文本写入有什么限制或什么因素会影响
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询