private void buttonLogIn_Click(object sender, EventArgs e)
        {
            // store employees email for later use
            string employeeEmail = comboBoxEmail.Text;
            // validate email and store any error messages received
            string errorMessage = LoginValidation.ValidateEmail(comboBoxEmail.Text);

            // if error message returned, turn the flag on
            if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                errorProvider.SetError(comboBoxEmail, errorMessage);
                return;
            }

            // check if password was not left blank before continuing
            if (string.IsNullOrWhiteSpace(textBoxPassword.Text))
            {
                errorProvider.SetError(textBoxPassword, "Password must not be left blank!");
                return;
            }

            // store results of validation as boolean values (bool emailValid, bool passwordValid)
            var(emailValid, passwordValid) = LoginValidation.ValidateCredentials(employeeEmail, textBoxPassword.Text);

            // if both email and password are valid, continue to main application
            if (emailValid && passwordValid)
            {
                // add logon entry to log file
                FileWriter.WriteLog("login");

                // if email address already occurs in the log file, delete it
                FileWriter.DeleteLine(MAIL_LOG_FILE, FileWriter.ContainsLine(MAIL_LOG_FILE, employeeEmail));
                // insert email address at the beginning of the file
                FileWriter.InsertAtBeginning(MAIL_LOG_FILE, employeeEmail);

                // hide current form
                this.Hide();

                // create main form and open it
                using (Main MainApplication = new Main(employeeEmail))
                    MainApplication.ShowDialog();

                // once main application closes, add logoff entry to event file
                FileWriter.WriteLog("logout");

                // open login page again
                this.Show();
                // load default settings of the login page
                LoadDefaultSettings();
            }
            // else if email incorrect
            else if (!emailValid)
            {
                errorProvider.SetError(comboBoxEmail, "Email address incorrect!");
            }
            // else if password incorrect
            else if (!passwordValid)
            {
                errorProvider.SetError(textBoxPassword, "Password incorrect!");
            }
            // in case of any inexpected errors
            else
            {
                FileWriter.WriteLog("login validation error");
                MessageBox.Show("Please report this error to your manager.", "Unexpected Error");
            }
        }