Click here to Skip to main content
Licence 
First Posted 5 Aug 2003
Views 123,961
Downloads 6,103
Bookmarked 110 times

A C# Personal Organizer

By Manster | 5 Aug 2003
This article will help you create your own personal organizer in C#
3 votes, 10.0%
1
2 votes, 6.7%
2
5 votes, 16.7%
3
7 votes, 23.3%
4
13 votes, 43.3%
5
4.23/5 - 30 votes
3 removed
μ 3.83, σa 2.35 [?]

Introduction

This application was created to give me a place to easily access the applications I often use without having to click on a desktop short cut. I also wanted a place to keep track of all my personal contacts and their information like cell phone numbers and email addresses. I didn’t want to bother with using Outlook to keep track of all this information since it’s a pain in the neck, plus I don't use it at home. I wanted something simple and portable based on xml. Customizing this application for your personal needs will take only seconds.

Features

When you run the application, if you click on the Tools button and then select My Contacts, you’ll see the application pictured above which I created to store all my personal contact’s information. This information is stored in a xml file called My_Contacts.xml. It is really easy to add and delete contacts through this interface which does all the xml work and updates for you. One cool feature of this application is when you open it up, if you right click the blue background behind the Collapsible Panel, you can add and delete notes you want leave yourself as reminders. This is something I find useful, although you may not.

Using the code

This application is not really complicated or to involved, but I find it useful so I thought others might as well.

The code below shows how you can add/update a contact's information in the xml file. First I pull the data from the windows controls, then I send it to a helper function which adds the data to the My_Contacts.xml file. The second function returns a MyContacts object (which is defined in the code) after it searches the My_Contacts.xml for all your entered personal contacts, creating your personal contacts list to display.

private void AddContact( XmlDocument XmlDoc, int iContactID,
string sFullName, string sCellPhone, string sHomePhone,
string sEmail, string sEmail2, string sAddress, string sCity,
string sState, string sZip, string sBDay )
{
    XmlElement xNodeParent = XmlDoc.DocumentElement;
    XmlElement xElemInvestment = XmlDoc.CreateElement( TagContact );
    xElemInvestment.SetAttribute( TagContactID, m_iNextID.ToString() );
    xNodeParent.AppendChild( xElemInvestment );

    sFullName = txt_Name.Text;
    sCellPhone = txt_Cell.Text;
    sHomePhone = txt_Home.Text;
    sEmail = txt_Email.Text;
    sEmail2 = txt_Email2.Text;
    sAddress = txt_Address.Text;
    sCity = txt_City.Text;
    sState = cmb_State.Text;
    sZip = txt_Zip.Text;
    sBDay = dt_DateTimePicker.Value.ToLongDateString();
           //ToString("yyy-MM-dd");

    // Add the child elements that make up the Contact element.

    AddXmlElement( XmlDoc, xElemInvestment, TagFullName, sFullName );
    AddXmlElement( XmlDoc, xElemInvestment, TagCellPhone, sCellPhone ); 
    AddXmlElement( XmlDoc, xElemInvestment, TagHomePhone, sHomePhone );
    AddXmlElement( XmlDoc, xElemInvestment, TagEmail, sEmail );
    AddXmlElement( XmlDoc, xElemInvestment, TagEmail2, sEmail2 ); 
    AddXmlElement( XmlDoc, xElemInvestment, TagStreetAddress, sAddress );
    AddXmlElement( XmlDoc, xElemInvestment, TagCity, sCity ); 
    AddXmlElement( XmlDoc, xElemInvestment, TagState, sState );
    AddXmlElement( XmlDoc, xElemInvestment, TagZipCode, sZip );
    AddXmlElement( XmlDoc, xElemInvestment, TagBDay, sBDay );
    // Commit changes to disk file.

    m_XmlDocument.Save( m_sXmlFileName );

    m_iContactID;
}

// This is how I'm getting your contacts from the My_Contacts.xml file

private XmlElement FindContactInXmlFile( XmlDocument doc, 
    string sContactID )
{
    XmlElement xNodeFound = null;

    XmlElement xRoot = doc.DocumentElement;

    XmlNodeList xNodeList = xRoot.GetElementsByTagName( TagContact );

    foreach( XmlNode xNodeContact in xNodeList ) 
    {  
        if( xNodeContact is System.Xml.XmlElement)
        {
            XmlElement xContact = (XmlElement) xNodeContact;

            string sIDFound = xContact.GetAttribute( "ContactID" );

            if( sIDFound != null && sIDFound == sContactID )
            {
                xNodeFound = xContact;
                break;
            }
        }
    }
    return xNodeFound;
}

Points of Interest

By using an xml flat file in place of a database, the possibilities are endless for storing and retrieving data.

People I'd like to thank

I like to thank Marc Clifton for his Outlook Bar, this is a great control. I changed a couple of small things but this is a first class submission. I'd also like to thank Derek Lakin for his Windows XP style Collapsible Panel Bar, this also a great control!

History

  • Version 1.0.0 7/31/03

Introduction

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Manster

Web Developer

United States United States

Member
Doug graduated college in 2000 with a degree in
Computer Information Systems. Since then Doug
has been working on software engineering projects
mostly for government consulting companies.
The majority of Doug's programming experience is in
windows development using C# and visual C++ with MFC.
Since October 2002, Doug has been using C# and has
been creating C# windows applications and ASP.NET web applications.


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralC:\Documents and Settings\Allan Gagnon\My Documents\My Programs\Doug_Personal_Organizer_src\MainForm.cs(30): The type or namespace name 'Salamander' could not be found (are you missing a using directive or an assembly reference?) Pinmemberallan.gagnon12:06 8 Jan '05  
GeneralRe: C:\Documents and Settings\Allan Gagnon\My Documents\My Programs\Doug_Personal_Organizer_src\MainForm.cs(30): The type or namespace name 'Salamander' could not be found (are you missing a using directive or an assembly reference?) PinmemberManster8:07 25 Feb '05  
GeneralRe: C:\Documents and Settings\Allan Gagnon\My Documents\My Programs\Doug_Personal_Organizer_src\MainForm.cs(30): The type or namespace name 'Salamander' could not be found (are you missing a using directive or an assembly reference?) Pinmembersaurabh710:21 24 Aug '05  
GeneralRe: C:\Documents and Settings\Allan Gagnon\My Documents\My Programs\Doug_Personal_Organizer_src\MainForm.cs(30): The type or namespace name 'Salamander' could not be found (are you missing a using directive or an assembly reference?) PinmemberManster12:21 24 Aug '05  
QuestionHow to create CollapsiblePanelBar.dll PinmemberNehalSS0:50 14 Aug '03  
AnswerRe: How to create CollapsiblePanelBar.dll PinmemberManster6:02 14 Aug '03  
NehalSS,
This is the article that I took the code from. Derek Lakin http://codeproject.com/cs/miscctrl/collapsiblepanelbar.asp created the control and shows you how to use it in his example app. I hope this helps.
Smile | :)
GeneralRe: How to create CollapsiblePanelBar.dll Pinmembervirendrasinh jhala1:04 22 Jun '04  
GeneralRe: How to create CollapsiblePanelBar.dll PinmemberManster6:05 23 Jun '04  
GeneralXML Serialization PinsussKenn Scribner3:13 13 Aug '03  
GeneralRe: XML Serialization PinmemberManster6:12 14 Aug '03  
GeneralRequires .NET 1.1 PinmemberKant5:45 7 Aug '03  
GeneralRe: Requires .NET 1.1 PinmemberManster5:59 7 Aug '03  
GeneralRe: Requires .NET 1.1 PinmemberVasudevan Deepak Kumar6:01 18 Aug '05  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web02 | 2.5.120210.1 | Last Updated 6 Aug 2003
Article Copyright 2003 by Manster
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid