表格VB.net的计时器 [英] Timer with form VB.net

查看:104
本文介绍了表格VB.net的计时器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好,我要再发布一次,我在计时器中遇到问题,我想在3、5和10秒后分别显示3个表格,该怎么做?

我的意思是,当第一种形式出现时,3秒钟后将出现另一种形式,然后5秒钟后将出现第二种形式,最后10秒钟后将出现另一种形式.我有一个代码,有人在Codeproject上给了我,但仅用于消息框,因此我对其进行了修改,以使表单仍然不起作用.这是我在下面的计时器中输入的代码:


Ok, I''m posting this again, I have a problem in timers, I want to display 3 forms each one after 3, 5 and 10 seconds, how to do that?

I mean when the first form appears, after 3 seconds another one will appear, then after 5 seconds the second will appear and finally after 10 seconds the another one will appear. I have a code where someone gave me here on Codeproject but its for message box only, thus I modify it to put a form still does not work. Here the code I put in the timer below:


If iCount < 100 Then i4.Show()
        iCount = iCount + 1
        tmrnote.Stop()

推荐答案

等于3 (假设您的计时器的周期为1 sec),第二个(当等于5 时),第三个(当定时器等于5 时) 等于10 .
:-)
You have to show the first form when iCount is equal to 3 (assuming your timer having period of 1 sec), the second one when it is equal to 5, the third one when it is equal to 10.
:-)


我认为该代码块位于计时器经过的事件内,因此应该是这样的东西

I take it that that code block is inside the timers elapsed event and so should be something like this

switch(count)
    case 0:
        Form1.Show();
        tmrNote.Interval = 3;
        count +=1;
        break;
    case 1:
        Form2.Show();
        tmrNote.Interval = 5;
        count +=1;
        break;
    case 2:
        Form3.Show();
        tmrNote.Interval = 10;
        count +=1;
        break;
    case 3:
        Form4.Show();
        tmrNote.Stop;
        break;



这确实是伪代码,但是您应该了解一下.

希望这会有所帮助.



This is really pseudo code, but you should get the idea.

Hope this helps.


这篇关于表格VB.net的计时器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆