views:

461

answers:

0

Hi, this is very strange. All of a sudden, I get this error message from Visual Studio saying that TypeInitializationException was unhandled. Searching for this error reveals that I should check if a variable is null(nothing) or not.

My scenario is like this. I have a separate GlobalVariables.vb module which I create variables in. I don't set them to anything. This is done in the MainWindow.vb Now, at onform_load of MainWindow, I try to set two variables to True and False so a button event handler can query the states of the variables. I cannot declare the variables in the button event handler either because the values need to be set before hand.
This worked like a charm a couple of hours ago. But now it does not.

GlobalVariables.vb

Friend isPlay As Boolean = False
Friend isPaused As Boolean = False

MainWindow.vb

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ''//TODO: This line of code loads data into the 'DataSourceDataSet.Sanger' table. You can move, or remove it, as needed.
    Me.SangerTableAdapter.Fill(Me.DataSourceDataSet.Sanger)

    isPlay = True
    isPaused = False

End Sub