Ok, my problem is very straightforward, but I have no idea why the code won't execute. The first 2 MsgBox-es popup fine, but after that it seems like the rest of the code doesn't get executed, and to be honest it's driving me crazy since I have no clue as to why it's happening.


vb.net Code:
  1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.  
  3.         Dim ProgramFiles As String = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
  4.         Dim LegLabs As String = ProgramFiles & "\Leg Labs"
  5.         Dim FileRenamer As String = LegLabs & "\File Renamer"
  6.  
  7.         If Directory.Exists(FileRenamer) Then
  8.             MsgBox("Add to Startup Check")
  9.             Using FileRead As StreamReader = New StreamReader(FileRenamer & "\Add to Startup.txt")
  10.                 If FileRead.ReadToEnd.ToString.Contains("True") Then
  11.                     Form3.StartupCheckBox.Checked = True
  12.                 Else
  13.                     Form3.StartupCheckBox.Checked = False
  14.                 End If
  15.                 FileRead.Close()
  16.             End Using
  17.         End If
  18.  
  19.         If Directory.Exists(FileRenamer) Then
  20.             MsgBox("Show Icon Tray Check") ' IT SEEMS LIKE THIS IS THE POINT WHERE THE CODE STOPS EXECUTING.
  21.             Using Fileread As StreamReader = New StreamReader(FileRenamer & "\Show Icon in Tray.txt")
  22.                 If Fileread.ReadToEnd.ToString.Contains("True") Then
  23.                     '           MsgBox("aaaaaaaa") THIS MSGBOX DOESN'T POPUP
  24.                     Form3.TrayIconBox.Checked = True
  25.                     '    NotifyIcon1.Visible = True
  26.                 Else
  27.                     Form3.TrayIconBox.Checked = False
  28.                     '      NotifyIcon1.Visible = False
  29.                 End If
  30.                 Fileread.Close()
  31.             End Using
  32.             MsgBox("zbzbz") ' THIS MSGBOX DOESN'T POPUP EITHER AND THE CODE BELOW DOESN'T EXECUTE
  33.         End If
  34.  
  35.         MsgBox(FileRenamer)
  36.  
  37.         If Directory.Exists(FileRenamer) Then
  38.             MsgBox("Always on Top Check")
  39.             Using FileRead As StreamReader = New StreamReader(FileRenamer & "\Always on Top.txt")
  40.                 If FileRead.ReadToEnd.ToString.Contains("True") Then
  41.                     Form3.AlwaysOnTopCheckBox.Checked = True
  42.                     '     MsgBox("Supposedly Done")
  43.                     Me.TopMost = True
  44.                 Else
  45.                     '    MsgBox("WHAT THE ****?")
  46.                     Form3.AlwaysOnTopCheckBox.Checked = False
  47.                     Me.TopMost = False
  48.                 End If
  49.  
  50.                 FileRead.Close()
  51.             End Using
  52.         End If
  53.  
  54.         MsgBox("File Renamer")
  55.         NotifyIcon1.Text = "File Renamer"
  56.         Timer1.Start()