我在代码中用自定义函数之间加System.Threading.Thread.Sleep 程序就停着不动,一直要强制关闭才可以
代码如下
Dim D1 As Date = Date.Now
Dim s As String
Dim s1 As String
Dim s2 As String
s = Functions.Execute("CaRio",0,"m0",0,1) ’ 自定义函数
s1 = Functions.Execute("CaReal",s) ’自定义函数
Functions.Execute("FONF",s1) ’自定义函数
System.Threading.Thread.Sleep(300)
s2 = Functions.Execute("ReNF") ’自定义函数
e.Form.Controls("Label1").text = s2
Dim D2 As Date = Date.Now
Dim t As TimeSpan = d2 - d1
MessageBox.Show(t.TotalSeconds)
但是当我在System.Threading.Thread.Sleep的前面加上messagebox的时候程序又正常了,代码如下
Dim D1 As Date = Date.Now
Dim s As String
Dim s1 As String
Dim s2 As String
s = Functions.Execute("CaRio",0,"m0",0,1) ’ 自定义函数
s1 = Functions.Execute("CaReal",s) ’自定义函数
Functions.Execute("FONF",s1) ’自定义函数
MessageBox.Show(1)
System.Threading.Thread.Sleep(300)
s2 = Functions.Execute("ReNF") ’自定义函数
e.Form.Controls("Label1").text = s2
Dim D2 As Date = Date.Now
Dim t As TimeSpan = d2 - d1
MessageBox.Show(t.TotalSeconds)
求解啊