alarme

Post your questions regarding programming in C# in here.
2 posts Page 1 of 1
Contributors
User avatar
hortencio
New Member
New Member
Posts: 19
Joined: Thu Apr 19, 2012 1:41 am

alarme
hortencio
How do i set an alarme in my system in vb, c# to tell me through message what i have set for that day? is there any code how to do so?
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: alarme
mandai
You could use a timer to check DateTime.Now to see if it matches what you want.
Code: Select all
        private void Form1_Load(object sender, EventArgs e)
        {
            timer1.Interval = 1000; //1 second
            timer1.Start();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            DateTime now = DateTime.Now;
            if (now.Date.ToString("dd-MM-yy") == "06-05-12")
            {
                if (now.Hour == 0 && now.Minute == 52)
                {
                    timer1.Stop();
                    MessageBox.Show("Time up");
                }
            }
        }
2 posts Page 1 of 1
Return to “General coding help”