Click here to Skip to main content
13,093,184 members (80,502 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hello, I'm new to 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)
            b = System.Convert.ToBoolean(a)
        Catch exception As System.InvalidCastException
            If a = True Then
            End If
        End Try
    End Sub

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...
Posted 9-Jan-13 15:30pm
Updated 9-Jan-13 19:39pm
It it System.Windows.Forms application? If so, tag "Forms". Always tag your UI library with a UI question...
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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:[^].

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.

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

why don you use javascript setTimeout function.. its rather more easier.. try it
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

I got it...

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 10 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100