Wait .5 seconds before continuing code VB.net

后端 未结 11 835
长发绾君心
长发绾君心 2021-02-05 04:25

I have a code and I want it to wait somewhere in the middle before going forward. After the WebBrowser1.Document.Window.DomWindow.execscript(\"checkPasswordConfirm();\",\"JavaSc

11条回答
  •  自闭症患者
    2021-02-05 05:20

    The problem with Threading.Thread.SLeep(2000) is that it executes first in my VB.Net program. This

    Imports VB = Microsoft.VisualBasic
    
    Public Sub wait(ByVal seconds As Single)
        Static start As Single
        start = VB.Timer()
        Do While VB.Timer() < start + seconds
            System.Windows.Forms.Application.DoEvents()
        Loop
    End Sub
    

    worked flawlessly.

提交回复
热议问题