Help please this is what i'm trying to do set a reminder in a differ form, for e.g i have input the contact in for in one form and and the contact want me to call them in a later date let say a wk to 2 wks from now. this is what i have so far
contact info form calling below form
how do i add it to call that form and keep it alive for that long?
got this code online
Sound _sound = null;
public Form1()
{
InitializeComponent();
InitializeDialogFields();
InitializeSound();
}
private void InitializeDialogFields()
{
dtStart.Value = DateTime.Now;
dtEnd.Value = DateTime.Now + TimeSpan.FromMinutes(60);
}
private void InitializeSound()
{
_sound = new Sound(Path.GetDirectoryName(Application.ExecutablePath) + "\\Beep1.wav");
}
private void InitializeNotifyBalloon()
{
notifyIcon1.BalloonTipTitle = "Test";
notifyIcon1.BalloonTipText = txtMessage.Text;
}
private void dateTimePicker3_ValueChanged(object sender, EventArgs e)
{
}
private void btnStart_Click(object sender, EventArgs e)
{
InitializeNotifyBalloon();
SetupTimer();
// hide this dialog from the task bar and the user
this.ShowInTaskbar = false;
this.Hide();
}
private void SetupTimer()
{
// for debugging purposes
// timer1.Interval = (int)udInterval.Value * 1000; // convert minutes to milliseconds
// start the timer at the user desired interval
timer1.Interval = (int)udInterval.Value * 1000 * 60; // convert minutes to milliseconds
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
// check to see if we reached the start time
if (CheckIfStartTimeHappened())
{
// show the bubble in the task bar hear
ShowReminder();
CheckIfWeReachedTheEndTime();
}
}
private bool CheckIfStartTimeHappened()
{
if (DateTime.Now > dtStart.Value)
return true;
return false;
}
private void CheckIfWeReachedTheEndTime()
{
if (DateTime.Now > dtEnd.Value)
{
// end is reached
// disable the timer
timer1.Stop();
}
}
private void ShowReminder()
{
notifyIcon1.ShowBalloonTip(2);
if (chkSound.Checked)
{
PlaySound();
}
}
private void PlaySound()
{
_sound.Play();
}
private void showDialogToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Show();
}
private void notifyIcon1_BalloonTipShown(object sender, EventArgs e)
{
// make sure the dialog is not being edited when we put the GUI thread to sleep
if (this.Visible == false)
{
System.Threading.Thread.Sleep(2000);
notifyIcon1.Visible = false;
notifyIcon1.Visible = true;
}
}
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.Show();
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}