Vb.net 运行程序时延迟代码执行
当程序仍在运行时,延迟应用程序中代码执行的最佳方法是什么 我尝试过这种方法:Vb.net 运行程序时延迟代码执行,vb.net,visual-studio,Vb.net,Visual Studio,当程序仍在运行时,延迟应用程序中代码执行的最佳方法是什么 我尝试过这种方法: System.Threading.Thread.Sleep() 但是在执行Sleep()之前,应用程序不会显示,我不确定是否有其他选择 Dim t = System.Threading.Tasks.Task(Of Boolean).Run(Function() As Boolean Syst
System.Threading.Thread.Sleep()
但是在执行Sleep()
之前,应用程序不会显示,我不确定是否有其他选择
Dim t = System.Threading.Tasks.Task(Of Boolean).Run(Function() As Boolean
System.Threading.Thread.Sleep(10000)
Return True
End Function)
Dim ret = t.Result
您需要将其转移到另一个线程,如果您在当前线程上调用sleep,那么包括UI在内的所有内容都将等待睡眠完成。实现这一点有多种方法,包括上面的示例。整理语言和格式。更多的背景信息,解释上下文,可能有助于获得建设性的答案。