CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Timer?

  1. #1
    Join Date
    Apr 2001
    Location
    ohio
    Posts
    300

    Timer?

    is there anyway to make a screen appear for a length of time then disappear without input from the user?


  2. #2
    Join Date
    Oct 2001
    Posts
    15

    Re: Timer?

    place a timer in the form and set the time length then unload the form (or hide it)


  3. #3
    Join Date
    Apr 2001
    Location
    ohio
    Posts
    300

    Re: Timer?

    can you give me a code example? i have not been able to get a timer to work



  4. #4
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: Timer?

    Very simple sample.
    Start a new project. Add a timer (Timer1)
    Paste this code into the general declarations section of the form
    Run the project. The form will appear. In 5 seconds it will unload itself.

    option Explicit

    private Sub Form_Load()
    Timer1.Interval = 5000 ' set interval for 5 seconds
    Timer1.Enabled = true ' start the timer
    End Sub

    private Sub Timer1_Timer()
    Unload me ' timer has expired. unload this form
    End Sub




    John G

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured