Below is a code that i have put together that has some problems. I'm making a recreation of a startbar in my application. The code checks to see if a temp file exist with the caption of another task. The whole code checks to see if it exist or not. Here is my problem when i open up a task for example task 1 it shows the task "perfect" but when i open up the second task it seems like it does not check to see if it exist at all it just uses the first task. Why is that? My COde:

Code:
'Below Is The Code That Generates And Checks The TaskBar
'Check To See If The Task Is Being Used
Dim IntCheckFile As Integer
    Dim fileNum As Integer
    IntCheckFile = FileExists("\CypexOS\MyServer\CypexOS\StartMenu\Task1.ini")
    Select Case IntCheckFile
      Case -1
      'Nope It Dosen't Exist!
      '---------------------------------------------------
      'Since The Task Dosen't Exist Save The Caption
          Dim hFile As Long
   Dim sFilename As String

   sFilename = App.path & ("\CypexOS\MyServer\CypexOS\StartMenu\Task1.ini")
   
  'obtain the next free file handle from the
  'system and and save the text box contents
   hFile = FreeFile
   Open sFilename For Output As #hFile
      Print #hFile, Me.Caption
   Close #hFile
   '---------------------------------------------------
   'Since The Caption Has Been Saved Get The Task Image
        StartbarMen.Task1.Picture = LoadPicture(App.path & "\CypexOS\Start\Tasks\TaskCYPEX.bmp")
        'Since The Task Has Been Set Set The Caption
    fileNum = FreeFile
    Open App.path & "\CypexOS\MyServer\CypexOS\StartMenu\Task1.ini" For Input As #fileNum
    ' Read the contents of the file into TextBox1
    StartbarMen.Task1C.Caption = Replace$(Input(LOF(fileNum), fileNum), vbCrLf, "")
    ' Close the file
    Close fileNum
    'Make Sure The Task is Visable
    StartbarMen.Task1.Visible = True
    StartbarMen.Task1C.Visible = True
      Case 0
      Case 1
      'So The Task Exist Look For The New Task!
      IntCheckFile = FileExists("\CypexOS\MyServer\CypexOS\StartMenu\Task2.ini")
    Select Case IntCheckFile
      Case -1
      'Nope It Dosen't Exist!
      'Since The Task Dosen't Exist Save The Caption

   sFilename = App.path & ("\CypexOS\MyServer\CypexOS\StartMenu\Task2.ini")
   
  'obtain the next free file handle from the
  'system and and save the text box contents
   hFile = FreeFile
   Open sFilename For Output As #hFile
      Print #hFile, Me.Caption
   Close #hFile
   'Since The Caption Has Been Saved Get The Task Image
        StartbarMen.Task2.Picture = LoadPicture(App.path & "\CypexOS\Start\Tasks\TaskCYPEX.bmp")
        'Since The Task Has Been Set Set The Caption
    fileNum = FreeFile
    Open App.path & "\CypexOS\MyServer\CypexOS\StartMenu\Task2.ini" For Input As #fileNum
    ' Read the contents of the file into TextBox1
    StartbarMen.Task2C.Caption = Replace$(Input(LOF(fileNum), fileNum), vbCrLf, "")
    ' Close the file
    Close fileNum
    'Make Sure The Task is Visable
    StartbarMen.Task2.Visible = True
    StartbarMen.Task2C.Visible = True
      Case 0
      Case 1
      'Nope It Dosen't Exist!
      'Since The Task Dosen't Exist Save The Caption

   sFilename = App.path & ("\CypexOS\MyServer\CypexOS\StartMenu\Task3.ini")
   
  'obtain the next free file handle from the
  'system and and save the text box contents
   hFile = FreeFile
   Open sFilename For Output As #hFile
      Print #hFile, Me.Caption
   Close #hFile
   'Since The Caption Has Been Saved Get The Task Image
        StartbarMen.Task3.Picture = LoadPicture(App.path & "\CypexOS\Start\Tasks\TaskCYPEX.bmp")
        'Since The Task Has Been Set Set The Caption
    fileNum = FreeFile
    Open App.path & "\CypexOS\MyServer\CypexOS\StartMenu\Task3.ini" For Input As #fileNum
    ' Read the contents of the file into TextBox1
    StartbarMen.Task3C.Caption = Replace$(Input(LOF(fileNum), fileNum), vbCrLf, "")
    ' Close the file
    Close fileNum
    'Make Sure The Task is Visable
    StartbarMen.Task3.Visible = True
    StartbarMen.Task3C.Visible = True
    Case 0
    Case 1
    'Nope It Dosen't Exist!
      'Since The Task Dosen't Exist Save The Caption

   sFilename = App.path & ("\CypexOS\MyServer\CypexOS\StartMenu\Task4.ini")
   
  'obtain the next free file handle from the
  'system and and save the text box contents
   hFile = FreeFile
   Open sFilename For Output As #hFile
      Print #hFile, Me.Caption
   Close #hFile
   'Since The Caption Has Been Saved Get The Task Image
        StartbarMen.Task4.Picture = LoadPicture(App.path & "\CypexOS\Start\Tasks\TaskCYPEX.bmp")
        'Since The Task Has Been Set Set The Caption
    fileNum = FreeFile
    Open App.path & "\CypexOS\MyServer\CypexOS\StartMenu\Task4.ini" For Input As #fileNum
    ' Read the contents of the file into TextBox1
    StartbarMen.Task4C.Caption = Replace$(Input(LOF(fileNum), fileNum), vbCrLf, "")
    ' Close the file
    Close fileNum
    'Make Sure The Task is Visable
    StartbarMen.Task4.Visible = True
    StartbarMen.Task4C.Visible = True
    Case 0
    Case 1
    'Nope It Dosen't Exist!
      'Since The Task Dosen't Exist Save The Caption

   sFilename = App.path & ("\CypexOS\MyServer\CypexOS\StartMenu\Task5.ini")
   
  'obtain the next free file handle from the
  'system and and save the text box contents
   hFile = FreeFile
   Open sFilename For Output As #hFile
      Print #hFile, Me.Caption
   Close #hFile
   'Since The Caption Has Been Saved Get The Task Image
        StartbarMen.Task5.Picture = LoadPicture(App.path & "\CypexOS\Start\Tasks\TaskCYPEX.bmp")
        'Since The Task Has Been Set Set The Caption
    fileNum = FreeFile
    Open App.path & "\CypexOS\MyServer\CypexOS\StartMenu\Task5.ini" For Input As #fileNum
    ' Read the contents of the file into TextBox1
    StartbarMen.Task5C.Caption = Replace$(Input(LOF(fileNum), fileNum), vbCrLf, "")
    ' Close the file
    Close fileNum
    'Make Sure The Task is Visable
    StartbarMen.Task5.Visible = True
    StartbarMen.Task5C.Visible = True
    Case 0
    Case 1
    End Select
   End Select
  End Select
 End Select
End Select