Im new to programming. I hope im not asking the wrong question here. But i got a problem i made an alarm that goes of in just one time but i want it to go of 4 diffrent times insted and i dont realy now how do do it. I would appreciate if any of you could give me a tips or somthing on how i should do.
any way heres my code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication7
{
public partial class Form1 : Form
{
tidpunkt tp = new tidpunkt();
DateTime alarmTime;
public Form1()
{
InitializeComponent();
DateTime dt = DateTime.Now;
tp.Sätt(dt.Hour, dt.Minute, dt.Second);
a.Text = tp.ToString();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void textBox4_TextChanged(object sender, EventArgs e)
{
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void label1_Click(object sender, EventArgs e)
{
}
private void timer1_Tick(object sender, EventArgs e)
{
tp.Tick();
a.Text = tp.ToString();
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
alarmTime = new DateTime(2010, 9, 25, 10, 36, 00, 00);
}
private void button4_Click(object sender, EventArgs e)
{
alarmTimer.Enabled = true;
}
private void alarmTimer_Tick(object sender, EventArgs e)
{
if (DateTime.Now.AddSeconds(-2) < alarmTime && DateTime.Now.AddSeconds(2) > alarmTime)
{
alarmTimer.Enabled = false;
MessageBox.Show("Alarm!");
}
}
}
}
This post has been edited by xzenon: 25 September 2010 - 09:07 AM

New Topic/Question
Reply




MultiQuote




|