Click here to Skip to main content
13,457,717 members
Click here to Skip to main content
Add your own
alternative version


42 bookmarked
Posted 8 May 2011

How can I remind myself of everything in my life?

, 13 May 2011
Rate this:
Please Sign up or sign in to vote.
Don't forget to use Reminder v1.0 to remind everything.



I usually forget about my home work, my exams, my jobs :/. So I decided to write an application to remind me of these. Almost all of you use your computers for hours every day. The computer is harmful for all of our brains if used for a long time. With this application, we won't forget our to-dos. I will also explain parts of the code for this application.


  • When you save a note, Reminder v1.0 saves it to File->Show Note ToolStripMenu for easy access. On every startup of Reminder v1.0, you can see these notes like in Office Word.
  • FeatureLikeWord.jpg

  • You can use your saved notes or write a new note for a TIMEDWARN. It chooses a note for you. TIMEDWARN is a warning message for which you can set the time and date.
  • FeatureTimedWarnAndCancelIT.jpg

  • Warning with sound or without sound.
  • FeatureTimedWarnWithSoundOrWithoutSound.jpg

  • You can choose Windows sounds for warning or custom songs (.mp3).
  • Here is a list of WarnSounds:



  • When you hover over Windows sounds or custom songs with mouse, you will be able to listen to them. This is implemented with Sound.Play() or the MCI API.
  • With Sound.PLay():


    With MCI Play command string:


  • And the app is now available with a Turkish or English interface.

Using the code

My main Form1.cs is formed of these parts:

  • Variables
  • Functions
  • For saving notes to menu:</li />

    private void SaveNoteToMenu(string text)
        newnote = new ToolStripMenuItem(text);
        newnote.Text = text;
        newnote.Click += new EventHandler(Item_Click);
        newnote.CheckedChanged += new EventHandler(Checked_Changed);
        newnote.CheckOnClick = true;
    private void TakeNotesToMenu()
        string[] Files = Directory.GetFiles(SavePath);
        foreach (string file in Files)
            FileInfo fileInfo = new FileInfo(file);
            if (fileInfo.Extension==".note")

    Check IsRTBStable: This function helps you to control RTB. I have four kinds of warnings to the user if something goes wrong. These are:

    string FirstRTBTEXT = "Write Your Note ..";
    string NameWarn = "First Give A Name Yo Your Note...";
    string notewarn = "FIRST WRITE SOMETHING";
    string NoNote = "There is No Note To Show";

    Then I should control the RTB so its text should not be these warnings.

    private bool IsRichTextBoxStable()
        if (richNote.Text != FirstRTBTEXT 
            && richNote.Text != null && richNote.Text != notewarn 
            && richNote.Text!=NameWarn && richNote.Text!=NoNote)
            return true;
            return false;
  • Form functions
  • On Form load, I check if the time is WarnTime. Is there a TIMEDWARN? Are notes Warned? Are there custom sounds? Get Windows sounds. I use four main if statements for these.</li />

  • Component functions
  • Here is the ToolStripMenuItem's Click event:

    I should check on click of the CustomSong menu or on ShowNote menu or Warn Sounds menu, but Sounds menu would be different from Notes menu. We can check this with the sender object and a few if statements.

    private void Item_Click(object sender, EventArgs e)
        if (sender is ToolStripMenuItem)  //Check On Click.
            foreach (ToolStripMenuItem item in 
                if (item == sender)
                    item.Checked = true;
                    clicked = true;
                    if (sender.ToString().Contains(".note"))
                    // If One Of Notes Clicked Then Show it
                        txtNoteName.Text = item.Text;
                        richNote.Text = functions.ShowNote(SavePath + "//" + 
                    else if (sender.ToString().Contains(".wav"))
                    //If Sound selected Get it
                        WarnSoundWAV = sender.ToString();
                        soundselected = true;
                        CustomSoundSelected = false;
                        functions.PlayStopSound(sender.ToString(), false);
                        foreach (ToolStripMenuItem snd in 
                            snd.Checked = false;
                    else  //If Mp3 Or Something Selected Get it
                        WarnCustomSound = sender.ToString();
                        CustomSoundSelected = true;
                        soundselected = false;
                        foreach (ToolStripMenuItem snd in 
                            snd.Checked = false;
                if ((item != null) && (item != sender))
                    item.Checked = false;

The OtherFunctions.cs class is formed of four parts:

  • DateTimeFunction:
  • All list of DateTime specialized string formats: Refer to MSDN. Or see the list here:

    String.Format("{0:t}", dt);  // "4:05 PM"                           ShortTime 
    String.Format("{0:d}", dt);  // "3/9/2008"                          ShortDate
    String.Format("{0:T}", dt);  // "4:05:07 PM"                        LongTime
    String.Format("{0:D}", dt);  // "Sunday, March 09, 2008"            LongDate
    String.Format("{0:f}", dt);  // "Sunday, March 09, 2008 4:05 PM"    LongDate+ShortTime
    String.Format("{0:F}", dt);  // "Sunday, March 09, 2008 4:05:07 PM" FullDateTime
    String.Format("{0:g}", dt);  // "3/9/2008 4:05 PM"                  ShortDate+ShortTime
    String.Format("{0:G}", dt);  // "3/9/2008 4:05:07 PM"               ShortDate+LongTime
    String.Format("{0:m}", dt);  // "March 09"                          MonthDay
    String.Format("{0:y}", dt);  // "March, 2008"                       YearMonth
    String.Format("{0:r}", dt);  // "Sun, 09 Mar 2008 16:05:07 GMT"     RFC1123
    String.Format("{0:s}", dt);  // "2008-03-09T16:05:07"               SortableDateTime
    String.Format("{0:u}", dt);  // "2008-03-09 16:05:07Z"              
                                 //  UniversalSortableDateTime
    public string GetDateTime(string DateOrClock)
        DateTime dt = DateTime.Now;
        if (DateOrClock == "Date")
            return String.Format("{0:D}", dt); // Long date day, month dd, yyyy
        else if (DateOrClock == "Clock")
            return String.Format("{0:T}", dt); // Long time hh:mm:ss AM/PM
        else if (DateOrClock == "DateAndClock")
            return String.Format("{0:f}", dt);
            // Full date/short time day, month dd, yyyy hh:mm
            return "";
  • Note functions:
  • StreamWriter and StreamReader help us write or read from a stream like text files. For more info, please refer to MSDN:

    public void SaveNote(string path, RichTextBox rtb)
        StreamWriter sw = new StreamWriter(path);
        for (int i = 0; i < rtb.Lines.Length; i++)
    public string ShowNote(string path)
        string Note;
        StreamReader sr = new StreamReader(path);
        Note = sr.ReadToEnd();
        return Note;
  • Warning functions:
  • SetStartup: Windows keeps all startup applications in Regedit "CurrentUser\SOFTWARE\Microsoft\Windows\CurrentVersion\Run". So we should set this with our application name and /autoRun command line.

    We use Checkstartup to check our OnStartup ToolStripMenuItem when application starts on form load event.

    public void SetStartup(bool start)
        RegistryKey rk = Registry.CurrentUser.OpenSubKey(
                         "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
        RegistryKey rkk = 
          Registry.CurrentUser.OpenSubKey("SOFTWARE\\Reminder v1.0\\Note", true);
        if (start)
            rk.SetValue(Path.GetFileName(Application.ExecutablePath).Replace(".exe", ""), 
                        Application.ExecutablePath.ToString() + " /autoRun");
            rkk.SetValue("CheckStartup", 1);
               Application.ExecutablePath).Replace(".exe", ""), false);
            rkk.SetValue("CheckStartup", 0);

    IsWarnTime: When user sets a TIMEDWARN, Reminder v1.0 writes a note to Registry, then with a timer, every second it should control the warnings. Let's get the Registry keys.

    public bool IsWarnTime()
        RegistryKey rk = 
          Registry.CurrentUser.OpenSubKey("SOFTWARE\\Reminder v1.0\\Note", true);
        DateTime dt = DateTime.Now;
        string[] DateParts = rk.GetValue("TIME").ToString().Split('.');
        if (dt.ToLongDateString() == 
              DateParts[0] && dt.ToLongTimeString() == DateParts[1] + 
              ":" + DateParts[2] + ":" + DateParts[3])
            //Set warned
            rk.SetValue("IsWarned", 1);
            return true;
            return false;
  • Get Windows sounds:
  • This is very easy. Windows keeps sounds in "C:\Windows\Media". We will just get them :)

    public ArrayList GetWindowsSounds()
        string[] AllFiles = Directory.GetFiles("C:\\Windows\\Media");
        ArrayList Sounds = new ArrayList();
        foreach (string file in AllFiles)
            FileInfo fileInfo = new FileInfo(file);
            if (fileInfo.Extension == ".wav")
        return Sounds;

    Play or stop these sounds: The SoundPlayer class is used to play ".wav" files. It just plays Wav files and uses the System.Media reference.

    public void PlayStopSound(string SoundPath,bool PlayOrStop)
        SoundPlayer Sound = new SoundPlayer(SoundPath);
        if (PlayOrStop)

    Use MCI to play songs: If you really want to learn about MCI, see my other article, or start from this website:

    public void OpenFileToPlay(string filename)
        string Pcommand = "open \"" + filename+ "\" type mpegvideo alias MediaFile";
        mciSendString(Pcommand, null, 0, IntPtr.Zero);
    public void Play(bool loop)
        string Pcommand = "play MediaFile";
        if (loop)
            Pcommand += " REPEAT";
        mciSendString(Pcommand, null, 0, IntPtr.Zero);
    public void StopSound()
        string Pcommand = "close MediaFile";
        mciSendString(Pcommand, null, 0, IntPtr.Zero);
    }  //MCI has three main Command String (Open,Play,Stop).I just used them.
    //For MCI add this to your line which class name is there.
    private static extern long mciSendString(string strCommand, StringBuilder strReturn,
            int iReturnLength, IntPtr hwndCallback);

And that's all. This is very simple way to implement a reminder. You can improve this small application in many ways. Don't forget the people who you love and who love you.


I am new at writing articles. :) Please support me to in doing this because I like it. And I believe I can do it better on every article. Thanks. Happy coding :)


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Team Leader Eterne
Turkey Turkey
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralRe: My vote of 3 Pin
SercanOzdemir9-May-11 0:29
memberSercanOzdemir9-May-11 0:29 
GeneralRe: My vote of 3 Pin
EdMan1969-May-11 7:00
memberEdMan1969-May-11 7:00 
GeneralRe: My vote of 3 [modified] Pin
SercanOzdemir9-May-11 11:05
memberSercanOzdemir9-May-11 11:05 
GeneralWhat is the added value in usage? Pin
JV99998-May-11 21:42
memberJV99998-May-11 21:42 
GeneralRe: What is the added value in usage? Pin
SercanOzdemir9-May-11 0:27
memberSercanOzdemir9-May-11 0:27 
GeneralRe: What is the added value in usage? Pin
JV999910-May-11 22:22
memberJV999910-May-11 22:22 
GeneralRe: What is the added value in usage? Pin
SercanOzdemir11-May-11 0:32
memberSercanOzdemir11-May-11 0:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04-2016 | 2.8.180323.1 | Last Updated 13 May 2011
Article Copyright 2011 by SercanOzdemir
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid