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();
        }

I don't understand what the question is or what you are trying to keep alive? You need to persist reminder information to disk some how with a database, configuration file, etc.

Ok this is what i'm trying to do.... i have the main form where where i enter the contac info i will then have another section in that main form with a checkbox when the checkbox is checked the frmreminder will popup and i can enter the time reminder is that help :(

Are you asking how to call another form when the state of the reminder checkbox changes?

namespace daniweb
{
  public partial class frmMain5 : Form
  {
    private bool loaded = default(bool);

    public frmMain5()
    {
      InitializeComponent();
    }

    private void frmMain5_Load(object sender, EventArgs e)
    {
      loaded = true;
    }

    private void checkBoxReminder_CheckedChanged(object sender, EventArgs e)
    {
      if (!loaded || !checkBoxReminder.Checked)
        return;
      using (frmReminder frm = new frmReminder())
      {
        frm.ShowDialog(); //Pass the reminder information somehow
      }
    }
  }
}

Are you asking how to call another form when the state of the reminder checkbox changes?

namespace daniweb
{
  public partial class frmMain5 : Form
  {
    private bool loaded = default(bool);

    public frmMain5()
    {
      InitializeComponent();
    }

    private void frmMain5_Load(object sender, EventArgs e)
    {
      loaded = true;
    }

    private void checkBoxReminder_CheckedChanged(object sender, EventArgs e)
    {
      if (!loaded || !checkBoxReminder.Checked)
        return;
      using (frmReminder frm = new frmReminder())
      {
        frm.ShowDialog(); //Pass the reminder information somehow
      }
    }
  }
}

thanks something like when i get home i will try that out...and let you know if that fit it

still not working yet but still working will update what i have soon

Just to be clear..... you want your contact reminder to pop-up after you check the contact reminder checkbox?

Is their more functionality that you would like?

What was the "keep open for a long time" statement about?

this is what i'm trying to do, 1) contact 2) time reminder 3) checkbox
on i'm on the contact form in there is checkbox ....when the checkbox is checked. it call time-reminder from for you to enter the time and date, to set it....when the time is set it should only appear when the date and time is reached. let's say it set for July 5, 2009 when that day reaches the alarm will appear and start beeping or do anything it was set to do..hope is cleared enough..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.