加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

vb.net 延迟时间

发布时间:2020-12-16 22:17:57 所属栏目:大数据 来源:网络整理
导读:在vb.net项目的windows窗体中,添加一个Timer控件 然后创造下面的方法 '延迟操作 'delayTime单位是毫秒,1000毫秒=1秒 Public Sub Delay(ByVal delayTime As Single) Dim timerCount As Single delayTime = delayTime / 1000 timerCount = Me.Timer1.Interval

在vb.net项目的windows窗体中,添加一个Timer控件

然后创造下面的方法

    '延迟操作
    'delayTime单位是毫秒,1000毫秒=1秒
    Public Sub Delay(ByVal delayTime As Single)
        Dim timerCount As Single

        delayTime = delayTime / 1000
        timerCount = Me.Timer1.Interval + delayTime
        While timerCount - Me.Timer1.Interval > 0
            Application.DoEvents()
            System.Threading.Thread.Sleep(1)
            timerCount = timerCount - 1
        End While
    End Sub

调用很简单:
Delay(3000)

其中3000是毫秒,也就是3秒钟

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读