private void btnSubmit_Click(object sender, EventArgs e)
        {
            // Role depending on teacher, principal or student
            int userRole = 0;

            // Adds one to try added to log on
            tries++;


            // try parses to check if input is integer
            if (Config.TryToParse(txt_Username.Text))
            {
                // if student radio button is checked
                if (rdb_student.Checked == true)
                {
                    // user role 1 is selected
                    userRole = 1;
                }

                // if teacher radio button is checked
                if (rdb_teacher.Checked == true)
                {
                    // user role 2 is selected for teacher
                    userRole = 2;
                }

                // if principal radio button is checked
                if (rdb_principal.Checked == true)
                {
                    // user role 3 is selected for principal
                    userRole = 3;
                }
            }
            else
            {
                // Message box is shown telling about incorrect login
                MessageBox.Show("Please enter your username in the correct format!",
                                "Invalid Login", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);

                // Resetting text box for user name
                txt_Username.Text = "";

                // Resetting text box for password
                txt_Password.Text = "";
            }

            // Switch case for user role
            switch (userRole)
            {
            // if case 1
            case 1:
                prgbarLoadingLogin.Value  = 0;
                prgbarLoadingLogin.Value += 2;      // progress bar increased by 1

                // if user input is correct
                if (DatabaseConnection.checkUser(txt_Username.Text, txt_Password.Text, 0))
                {
                    // progress bar increased by 1
                    prgbarLoadingLogin.Value += 2;

                    // Student profile is loaded
                    frmStudentProfile sForm = new frmStudentProfile();
                    prgbarLoadingLogin.Value += 2;
                    // Activates student profile form
                    sForm.Activate();

                    // Progress bar increased by 1
                    prgbarLoadingLogin.Value += 2;

                    // Temporarily sets the config file as this student so it can be shared between the classes
                    Config.setStudent(DatabaseConnection.loadStudent(txt_Username.Text));

                    // Progress bar increased by 1
                    prgbarLoadingLogin.Value += 2;

                    // Message box showing successful logon
                    MessageBox.Show("Successfully Logged In");
                    // Student Profile form shown
                    sForm.Show();



                    // Hides logon on form
                    this.Hide();

                    Config.userRole = 1;     // user role is set to 1
                }
                else
                {
                    // Message box is shown login failed
                    MessageBox.Show("Login Failed");
                    // If login tries is above 3
                    if (tries > 3)
                    {
                        // Application is exited
                        Application.Exit();
                    }
                }
                // leaves case
                break;

            // if case 2
            case 2:
                prgbarLoadingLogin.Value  = 0;
                prgbarLoadingLogin.Value += 2;
                // if user input is correct
                if (DatabaseConnection.checkUser(txt_Username.Text, txt_Password.Text, 1))
                {
                    // gets teacher information
                    Teacher getTeacher = DatabaseConnection.getTeacher(Convert.ToInt32(txt_Username.Text));
                    prgbarLoadingLogin.Value += 2;

                    // Sets teacher info
                    Config.setTTeacher(getTeacher);
                    prgbarLoadingLogin.Value += 2;

                    // teacher profile is loaded
                    frmTeacherProfile fTP = new frmTeacherProfile();

                    prgbarLoadingLogin.Value += 2;
                    // teacher profile is activated

                    fTP.Activate();
                    prgbarLoadingLogin.Value += 2;

                    // login screen is hidden
                    this.Hide();

                    // shows teacher profile
                    fTP.Show();

                    Config.userRole = 2;      // user role is set to 2
                }
                else
                {
                    // if login fails shows message box showing so
                    MessageBox.Show("Login Failed");
                    // if tries to login exceeds 3
                    if (tries > 3)
                    {
                        // program is exitted
                        Application.Exit();
                    }
                }

                break;

            // if case 3
            case 3:
                prgbarLoadingLogin.Value  = 0;
                prgbarLoadingLogin.Value += 4;
                // checks to see if user input for principal is correct
                if (DatabaseConnection.checkUser(txt_Username.Text, txt_Password.Text, 2))
                {
                    // principal panel is loaded
                    prgbarLoadingLogin.Value += 2;
                    frmPrincipalPanel pP = new frmPrincipalPanel();

                    prgbarLoadingLogin.Value += 2;
                    // principal panel is activated
                    pP.Activate();

                    prgbarLoadingLogin.Value += 2;
                    // principal panel is shown
                    pP.Show();

                    // login screen is hidden
                    this.Hide();

                    Config.userRole = 3;
                    // Eser role 3 is set
                }
                else
                {
                    // if login fails shows message box saying so
                    MessageBox.Show("Login Failed");
                    // if tries to login exceeds 3
                    if (tries > 3)
                    {
                        // program is exitted
                        Application.Exit();
                    }
                }

                break;
            }
        }