Trying to show other form if textbox's text is correct. When I debug I get an error saying "Object reference not set to an instance of an object". The code is below:
'OK is OK button, MainForm is the form I'm trying to open
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
Dim pass As String = My.Computer.FileSystem.ReadAllText("password.txt")
If PasswordTextBox.Text = pass Then
MainForm.Owner = Me
Me.Hide()
'"Object reference not set to an instance of an object" error when debugging on line below
MainForm.Show()
End If
End Sub