Results 1 to 6 of 6

Thread: Countdown program [RESOLVED]

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Countdown program [RESOLVED]

    Hi all,

    I'd like to make a program that includes a countdown - you can either specify a date/time or set a countdown timer, and when it reaches the specified time it executes code (shuts down the PC in this case).

    I've heard that the VB timer built in isn't very good; I was wondering if there's anything better?

    I've come across This but it just says that I don't have the correct licence when I try to run it (I have registered it within VB).

    Any ideas of how I might go about doing this?

    Thanks
    Last edited by BubbleLife; Sep 10th, 2005 at 02:36 PM.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Countdown program

    The VB timer is not very accurate when it comes to precision timings but for something like this its ok.

    You will need to use DateDiff to determine if the time/date has expired. I assume that you dont want it firing every second.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    Frenzied Member wiz126's Avatar
    Join Date
    Jul 2005
    Location
    Mars,Milky Way... Chit Chat Posts: 5,733
    Posts
    1,080

    Re: Countdown program

    as RobDog said the vb timer is not acurate if it comes to counting in a less then milliseconds, in your case it won't do much of a change but if you really want a good acurate controll check this, its free and got tons of extras:

    TRY THIS
    1) If your post has been adequately answered please click in your post on "Mark Thread Resolved".
    2) If someone has been useful to you please show your respect by rating their posts.
    3) Please use [highlight="VB"] 'your code goes in here [/highlight] tags when posting code.
    4) Before posting your question, make sure you checked this links:
    MICROSOFT MSDN -- VB FORUMS SEARCH

    5)Support Classic VB - A PETITION TO MICROSOFT

    ___________________________________________________________________________________
    THINGS TO KNOW ABOUT VB: || VB Examples/Demos
    What are Classes?
    || -
    Where to place a sub/function?(global) || Webbrowser control

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Re: Countdown program

    Ahh, I see, thank you

    My other question, then, would be how to actually use the timer in this way? I've not had any experiance with timers up to now, since I'm really a newbie to VB (I just make programs based on the little unit we covered in our college course, which was only a small unit).

    I have a book which shows how to make it execute something on every interval of the timer but what I really need is for it to do two things:

    A. Change a text label or similar each interval to show how much time is remaining (basically so it looks like it's counting down)

    B. Execute the script when the countdown reaches 0

    I was planning to have a countdown system (They specify, say, "2 hours" and it counts down, or they just pick a date/time to activate). Whether this will require different timers or a different way of working I'm not sure

    I've attatched a rudimentary idea of what i'm trying to do. Any advice for using timers here? Remember, I really don't have any idea how they work.


    Thanks
    Attached Images Attached Images  

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Countdown program

    This is very accurate. It counts down from 5 miutes.

    http://vbforums.com/attachment.php?attachmentid=38882

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Re: Countdown program

    Ah! That's great, thank you

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