// Main method
        private void MathQ_Load(object sender, EventArgs e)
        {
            // This hides the skip and next button when the form is first loaded
            skip_btn.Hide();
            next_btn.Hide();

            // Initialises the integer variable currentQNo to 2
            nextQNo = 2;

            // Initialises the integer variable numOfQAnsCorr to 0
            numOfQAnsCorr = 0;

            // Creates a new NumOfQ form
            using (NumOfQ newForm = new NumOfQ())
            {
                // Hides the Qna form
                this.Hide();

                // Displays the new NumOfQ form and if the NumOfQ form is closed without confirming the number of questions they want to answer, the user is redirected back to the main menu form
                if (newForm.ShowDialog() == DialogResult.OK)
                {
                    // Initialises the integer variable numOfQVal to the number of questions that are to appear
                    numOfQVal = newForm.numOfQVal;

                    // Releases all resources used by the new form
                    newForm.Dispose();

                    // Tries to create a connection to the database and otherwise catches the error and tells the user what the error is
                    try
                    {
                        // Declaring the connection
                        using (SqlConnection connection = new SqlConnection())
                        {
                            // This allows us to connect to SQL Server
                            connection.ConnectionString = Program.connectionString;

                            // Opens the connection to the database
                            connection.Open();



                            // Randomly selects a question from the database and stores it in the object
                            activity.weight(connection);

                            // Extracts the question from the object and displays it on the question_lbl
                            question_lbl.Text = activity.getQuestion();



                            // Closes the connection to the database
                            connection.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error:\n\n" + ex);
                    }
                }
                else
                {
                    this.Close();
                }
            }
        }
        // Main method
        private void TimedMC_Load(object sender, EventArgs e)
        {
            // Creates a new NumOfQ form
            using (NumOfQ newForm = new NumOfQ())
            {
                // Hides the Qna form
                this.Hide();

                // Displays the new NumOfQ form and if the NumOfQ form is closed without confirming the number of questions they want to answer, the user is redirected back to the main menu form
                if (newForm.ShowDialog() == DialogResult.OK)
                {
                    // This hides the skip and next button when the form is first loaded
                    skip_btn.Hide();
                    next_btn.Hide();

                    // Initialises the integer variable currentQNo to 2
                    nextQNo = 2;

                    // Initialises the integer variable numOfQAnsCorr to 0
                    numOfQAnsCorr = 0;

                    // This allows the timer to tick
                    timer.Tick += new EventHandler(timer_Tick);

                    // This sets the interval of the timer to 1s
                    timer.Interval = 1000;

                    // Creates a new TimeAllocated form
                    using (TimeAllocated newForm2 = new TimeAllocated())
                    {
                        // Displays the TimeAllocated form and if the TimeAllocated form is closed without confirming the time allocated, the user is redirected back to the main menu form
                        if (newForm2.ShowDialog() == DialogResult.OK)
                        {
                            // This initialises the integer variable timeAllocated to the amount of time the user has requested
                            timeAllocated = newForm2.timeAllocatedVal;

                            // This initialises the integer variable timeLeft to the value in the integer variable timeAllocated
                            timeLeft = timeAllocated;

                            // Releases all resources used by the new form
                            newForm2.Dispose();

                            // Updates the time left displayed in timer_display_lbl
                            timerDisplay_lbl.Text = "Time left: " + timeLeft.ToString();

                            // Initialises the integer variable numOfQVal to the number of questions that are to appear
                            numOfQVal = newForm.numOfQVal;

                            // Releases all resources used by the new form
                            newForm.Dispose();

                            // Tries to create a connection to the database and otherwise catches the error and tells the user what the error is
                            try
                            {
                                // Declaring the connection
                                using (SqlConnection connection = new SqlConnection())
                                {
                                    // This allows us to connect to SQL Server
                                    connection.ConnectionString = Program.connectionString;

                                    // Opens the connection to the database
                                    connection.Open();



                                    // Randomly selects a question from the database and stores it in the object
                                    activity.weight(connection);

                                    // Calls on a procedure that displays the questions and answers
                                    displayQsAndAs();



                                    // Closes the connection to the database
                                    connection.Close();

                                    // Starts the timer
                                    timer.Start();
                                }
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("Error:\n\n" + ex);
                            }
                        }
                        else
                        {
                            this.Close();
                        }
                    }
                }
                else
                {
                    this.Close();
                }
            }
        }