一段时间后弹出 [英] pop up after a certain time

查看:102
本文介绍了一段时间后弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我是Vb.net的新手,我的项目有问题

这里是一个示例代码

Hello, I''m new to Vb.net and I have a problem with regards to my project
here''s a sample code

Private Sub MinsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MinsToolStripMenuItem.Click
        Dim b As Boolean
        MsgBox(" pop up will return on " & Now.AddMinutes(5))

        Dim a = Now.AddMinutes(5)
        Try
            b = System.Convert.ToBoolean(a)

        Catch exception As System.InvalidCastException
            If a = True Then
                PopupNotifier1.Popup()

            End If
        End Try
    End Sub



我想要的是什么时候我点击ToolStripMenuItem,它将等待五分钟,然后popnotifier1将弹出...



任何帮助将不胜感激...


what i want is that when i click the ToolStripMenuItem, it will wait for five minutes and then popnotifier1 will popup...

any help will be appreciated...

推荐答案

首先, System.Convert.ToBoolean(a)不仅是坏或坏,这是胡言乱语。你试图表达什么?!



突然出现任何东西,经过一段时间后是一件坏事。

如果你真的认为你需要做这件坏事(谁知道为什么?那么,也许......),你应该知道:这是一个非常罕见的情况,当你可以使用真的,非常糟糕的,因此几乎从未用过质量软件,计时器 System.Window.Forms.Timer http://msdn.microsoft.com/en-us/library/system.windows.forms.timer.aspx [ ^ ]。



由于准确性最差,计时器很糟糕,所以如果它对某些东西有好处,这就是你的问题,不需要很好的准确性。但是这个在使用中高度简化。阅读上面提到的帮助页面;您将看到如何使用它。



.NET FCL中可用的其他三个(或左右)计时器类要好得多,但它们都需要至少最少的编程要使用的读写能力,例如UI线程调用, Dispatcher 等。



-SA
First of all, "System.Convert.ToBoolean(a)" is not just bad or wrong, this is gibberish. What did you try to express with that?!

To pop up anything all of a sudden, after a certain time is a bad thing.
If you really think you need to do this bad thing (who knows why? so, maybe…), you should know: this one of really rare cases when you can use the really, really bad, and hence almost never used in quality software, timer System.Window.Forms.Timer: http://msdn.microsoft.com/en-us/library/system.windows.forms.timer.aspx[^].

The timer is bad due to poorest possible accuracy, so if it''s good for something at all, this is your problem, where good accuracy is not needed. But this one is highly simplified in use. Read the help page referenced above; and you will see how to use it.

Other three (or so) timer classes available in .NET FCL are much better, but they all require at least minimal programming literacy to use, such as UI thread invocation, Dispatcher and the like.

—SA


为什么不使用javascript setTimeout函数..它更容易..试试吧
why don you use javascript setTimeout function.. its rather more easier.. try it


我明白了...



我刚刚使用thread.sleep而且工作正常!!!!
I got it...

I just used thread.sleep and it worked!!!!


这篇关于一段时间后弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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