Click here to Skip to main content
15,896,726 members
Articles / Desktop Programming / Win32

Address Book and Events Reminder

Rate me:
Please Sign up or sign in to vote.
4.74/5 (37 votes)
13 Feb 2009CPOL16 min read 105.6K   10.7K   106  
Allows to maintain and backup your contacts and also maintains a reminder. You can store data in any of the three different databases like Microsoft SQL Server, MySql, Microsoft Access
using System;
using System.Windows.Forms;

namespace AddressBook
{
    static class Program
    {
        public static DataConnection Connection;

        [STAThread]
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            try
            {
                DataConnection.GetSettings();
            }
            catch
            {
                if (MessageBox.Show("The database connections had not been configured. Do you want to configure it now?", "Address Book", MessageBoxButtons.YesNo) == DialogResult.No) return;
                if (new frmSettings().ShowDialog() == DialogResult.Cancel) return;
                MessageBox.Show("Now the application will restart to apply the settings.", "Address Book");
                Application.Restart();
                return;
            }
            try
            {
                (Connection = DataConnection.GetConnection()).Open();
            }
            catch (Exception Ex)
            {
                MessageBox.Show("Could not access the database. This application needs to exit.\n\nError Message:\n" + Ex.Message, "Connection Error");
                return;
            }

            Application.Run(new frmMain());
            Application.Run(new frmContacts());
        }

        public static bool ValidateEmail(string Email)
        {
            if ((Email.IndexOf('@') != Email.LastIndexOf('@')) || Email.IndexOf('@') == -1) return false;

            if (Email[Email.IndexOf('@') + 1] == '.') return false;

            if ((Email.LastIndexOf(".") == Email.Length - 1) || Email.LastIndexOf(".") == -1) return false;

            if (Email.Contains(" ") || Email.Contains("\\") || Email.Contains("/") || Email.Contains("*") || Email.Contains(";")) return false;

            return true;
        }

        public static bool HasChars(string Value)
        {
            foreach (char c in Value)
            {
                if ((int)c < 48 || (int)c > 57) return true;                
            }
            return false;
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Software Developer
India India


Completed B.Com(CS) at DGVC and GNIIT Software Engineering at NIIT. Resident at Chennai and working as a Software Engineer.



 Language / Technology :

C#, ADO.NET, ASP.NET, MVC, WCF, ASP, PHP, XML, Java, J2EE, HTML, JavaScript, JQuery, AngularJS, VB Script, C++, MS SQL Server, SSRS, MySql, Oracle, Oracle Forms Development, Windows, Linux.



Click here to view other articles.


Mail Me at:  shridhar_tl@ymail.com


Visit my Site:  www.iCodeIt.in


Comments and Discussions