I am brand new to C#. I actually studied Java years ago at University but obviously didn't learn it very well! Now I'm very keen on learning C# from the ground up. I have a decent idea of the absolute basics, but have now come unstuck.

I am building a relatively simple Quiz "Game" application using WPF. The user clicks the "Load Quiz" button, which loads a text file which contains questions and answers. The user then clicks "Next Question", which loads the first question and the four multiple choices into text boxes. This all seems to be working ok.

The user then clicks on the button 1/2/3/4 corresponding to the correct answer. When they do this, I want the "Correct! Well done" text to display in tResult if the correct answer is chosen, or the other text if answer is incorrect.

However, clicking a button makes no immediate action, until bNextQ\_Click is clicked, when finally the "Sorry, that is incorrect" displays in tResult.

It would appear that the boolean flags are remaining false, so there is no recognition of the click event.

PLEASE NOTE: I realise my code will be a mess and I am sure that I am doing this in a bad and inefficient manner. Any advice gratefully accepted!

Anyway, here is the code, any feedback is much appreciated:

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;

namespace QuizGame
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{

    public MainWindow()
    {
        InitializeComponent();
    }

    private bool button1Clicked = false;
    private bool button2Clicked = false;
    private bool button3Clicked = false;
    private bool button4Clicked = false;

    private int score = 0;

    private void txtQuestion_TextChanged()
    {
        throw new NotImplementedException();
    }

    private void bNextQ_Click(object sender, RoutedEventArgs e)
    {
        questionIteration();

    }

    private void numQuestions_TextChanged(object sender, TextChangedEventArgs e)
    {

    }

    private void button1_Click(object sender, RoutedEventArgs e)
    {
        button1Clicked = true;
    }

    private void button2_Click(object sender, RoutedEventArgs e)
    {
        button2Clicked = true;
    }

    private void button3_Click(object sender, RoutedEventArgs e)
    {
        button3Clicked = true;
    }

    private void button4_Click(object sender, RoutedEventArgs e)
    {
        button4Clicked = true;
    }

    private void txtQuestion_TextChanged(object sender, TextChangedEventArgs e)

    {
        //txtQuestion.Text = splitted[];

    }

    private void button_Load_Quiz_Click(object sender, RoutedEventArgs e)
    {
        int lineCount = File.ReadLines(@"C:\\Users\Morgan\Documents\Visual Studio 2010\Projects\QuizGame\QuizGame\Quiz.txt").Count();

        numQuestions.Text = lineCount.ToString();

        txtQuestion.Text = "Press 'Next Question' to start.";
    }

    private void questionIteration()
    {

        int i = 0;

        string[] questionArray = File.ReadAllLines(@"C:\\Users\Morgan\Documents\Visual Studio 2010\Projects\QuizGame\QuizGame\Quiz.txt");

        foreach (string qArrays in questionArray)
        {

            string question = questionArray[i];

            string[] splitted = question.Split('|');

            txtQuestion.Text = splitted[0];
            textBox1.Text = splitted[1];
            textBox2.Text = splitted[2];
            textBox3.Text = splitted[3];
            textBox4.Text = splitted[4];

            string correct = splitted[5];

            if (button1Clicked == true)
            {
                if (correct == textBox1.Text)
                {
                    score++;

                    tResult.Text = "Correct! Well done.";
                }
                else tResult.Text = "Sorry, that is incorrect.";

            }

            if (button2Clicked == true)
            {
                if (correct == textBox2.Text)
                {
                    score++;

                    tResult.Text = "Correct! Well done.";
                }
                else tResult.Text = "Sorry, that is incorrect.";

            }

            if (button3Clicked == true)
            {
                if (correct == textBox3.Text)
                {
                    score++;

                    tResult.Text = "Correct! Well done.";
                }
                else tResult.Text = "Sorry, that is incorrect.";

            }

            if (button4Clicked == true)
            {
                if (correct == textBox4.Text)
                {
                    score++;

                    tResult.Text = "Correct! Well done.";
                }
                else tResult.Text = "Sorry, that is incorrect.";

            }

            i++;
            button1Clicked = false;
            button2Clicked = false;
            button3Clicked = false;
            button4Clicked = false;
        }

    }

}
}

```