Program can't run due to TypeInitializationException, not sure how to fix
<p>I've been trying to get this program to work, but when I try to run it, nothing happens. I attempted debugging, and it told me that I had a TypeInitializationException, so I looked online for a fix, but I wasn't able to find anything that could help me. Here's my code; the program is a GUI, where the computer randomly selects one of three letters (A, B, or C) ten times, and the user tries to guess which letter was selected. The high schore is saved to a file, and is read from that file and displayed.</p>

<p>Any help at all would be greatly appreciated.</p>

<pre><code>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace HighScore
{

    public partial class Form1 : Form
{

    const string FILENAME = @"C:\\Guess\\Data.txt";
    static FileStream outFile = new FileStream(FILENAME, FileMode.Create, FileAccess.Write);
    StreamWriter writer = new StreamWriter(outFile);
    static FileStream file = new FileStream(FILENAME, FileMode.Open, FileAccess.Read);
    StreamReader reader = new StreamReader(file);

    string answer;
    string input;
    int writenum;
    string num;





    public Form1()
    {
        InitializeComponent();
    }

    private void label1_Click(object sender, EventArgs e)
    {

    }

    private void label2_Click(object sender, EventArgs e)
    {

    }

    private void label3_Click(object sender, EventArgs e)
    {

    }

    private void textBox1_TextChanged(object sender, EventArgs e)
    {

    }

    private void button1_Click(object sender, EventArgs e)
    {

        Random ranNumberGenerator = new Random();
        int randomNumber;
        int x;

        num = reader.ReadLine();
        writenum = Convert.ToInt32(num);
        label1.Text = "Score: " + writenum;
        label1.Visible = true;




        randomNumber = ranNumberGenerator.Next(1, 3);
        if (randomNumber == 1)
        {
            answer = "a";
        }
        if (randomNumber == 2)
        {
            answer = "b";
        }
        if (randomNumber == 3)
        {
            answer = "c";
        }
        if (textBox1.Text == "a")
        {
            input = "a";
        }
        if (textBox1.Text == "b")
        {
            input = "b";
        }
        if (textBox1.Text == "c")
        {
            input = "c";
        }

        if (answer == input)
        {
            label2.Text = "Correct! Computer guessed " + answer + " and you guessed " + input;
            label2.Visible = true;

            num = reader.ReadLine();
            writenum = Convert.ToInt32(num);
            writenum = writenum + 1;
            num = writenum.ToString();


        }


        for (x = 0; x &lt; 10; ++x)
        {
            button1.Enabled = false;
        }
    }
}
</code></pre>

<p>}</p>
