Need help with a count down timer

This is a discussion on Need help with a count down timer within the C# Programming forums, part of the General Programming Boards category; Code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication1 { public partial ...

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    26

    Unhappy Need help with a count down timer

    Code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    
    namespace WindowsApplication1
    {
        public partial class form1 : Form
        {
            public form1()
            {
                InitializeComponent();
            }
    
            private void form1_Load(object sender, EventArgs e)
            {
    
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                int count = 1;
    
    
    
                if (count == 1)
                {
                    System.Diagnostics.Process.Start("explorer.exe");   //start explorer
                    count++; // increment count by 1 to skip starting explorer next time.
    
                    // this.Visible = false;
                    this.label1.Visible = false;  // get rid of the label telling you your session will start when you hit 'Accept'
    
                    CountDown(); // start the counter
    
                }
    
            }
    
    
    
            private void button1_MouseEnter(object sender, EventArgs e)
            {
                button1.BackColor = Color.FromArgb(240, 240, 240);
            }
    
            private void button1_MouseLeave(object sender, EventArgs e)
            {
                button1.BackColor = Color.FromArgb(192, 192, 255);
            }
    
            private void button2_MouseEnter(object sender, EventArgs e)
            {
                button2.BackColor = Color.FromArgb(240, 240, 240);
            }
    
            private void button2_MouseLeave(object sender, EventArgs e)
            {
                button2.BackColor = Color.FromArgb(192, 192, 255);
            }
    
            private void button2_Click(object sender, EventArgs e)
            {
                System.Diagnostics.Process.Start("shutdown", "-r");  // Shutdown system. ending patron session
                this.Close();
            }
    
            private void pictureBox1_Click(object sender, EventArgs e)
            {
    
            }
    
    
            private void CountDown()
            {
    
    
    
    
    
            }
    
            private void DisplayMethod()
            {
    
            }
    
            private void form1_Click(object sender, EventArgs e)
            {
                this.Close();
            } // this is for safty to kill the application at any time durning testing
    
          
    
            }
        }
    As you can see, after hitting button1 for the first time, we will jump to a CountDown() method, which I originaly planed on using to put my timer code in to keep things clean.

    I have looked on MSDN, for timer: http://search.msdn.microsoft.com/sea...=0&query=timer

    but there was so much there, I didn't know where to really start, I also tryed google, with confusing results.

    It's prob not as hard as I'm making it. I wanted this timer to count down from 30 min. Can someone *please* help me get started with a timer that would count down 30 min?

    EDIT: ok, this is what I have for my timer so far http://www.nomorepasting.com/paste.php?pasteID=64923 when I set int StartTime = 900; my program does its disapearing thing for exactly 9 secounds... but when I set int StartTime = 1000; my program only does its thing for 6 secounds... wierd or what? I have the alarm component interval set to 1
    Last edited by GUIPenguin; 07-07-2006 at 07:25 PM. Reason: figured it out...a tad bit....but it still doesnt seem to work all that right

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. bintree and count (withouth using template)?
    By cubimongoloid in forum C++ Programming
    Replies: 7
    Last Post: 05-24-2009, 07:22 AM
  2. tic tac toe crashes :(
    By stien in forum Game Programming
    Replies: 4
    Last Post: 05-13-2007, 07:25 PM
  3. input question
    By piyush_v in forum C Programming
    Replies: 9
    Last Post: 04-12-2007, 08:09 AM
  4. Program Crashing
    By Pressure in forum C Programming
    Replies: 3
    Last Post: 04-18-2005, 11:28 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21