Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: 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
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
fox07374
Edited 9-Jan-13 19:39pm
v6
Comments
Sergey Alexandrovich Kryukov at 9-Jan-13 22:30pm
   
It it System.Windows.Forms application? If so, tag "Forms". Always tag your UI library with a UI question... —SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

I got it...
 
I just used thread.sleep and it worked!!!!
  Permalink  
Rate this: bad
good
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: 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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

why don you use javascript setTimeout function.. its rather more easier.. try it
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 367
1 Abhinav S 226
2 thatraja 220
3 OriginalGriff 195
4 Peter Leow 160
0 Sergey Alexandrovich Kryukov 8,849
1 OriginalGriff 5,035
2 Peter Leow 3,949
3 Maciej Los 3,535
4 Abhinav S 3,148


Advertise | Privacy | Mobile
Web02 | 2.8.140415.2 | Last Updated 10 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid