title: problem with calling functions in visual basic
body: <p>I've been learning visual basic lately and decided to do a some code using functions,file reading and writelines. the way I'm trying to make it work, the code should be getting information from files I've written and should produce a file after the program itself runs, as well as a messagebox popping up to say that the program is finished. However, I currently can't even get the messagebox to pop up. I'm not sure what I've done wrong, and although I know this specific project is an odd one I've included the code for it below in the hopes someone can help me with it as I can't find any examples that are exactly similar to what I'm attempting. Anyways, any help would be appreciated, thank you!</p>
  <pre><code>Imports System.IO
  Class Form1
      Private Sub Button1_Click(sender As Object, e As EventArgs)
          Dim fs As New System.IO.FileStream(&quot;a9output.txt&quot;, IO.FileMode.Create, IO.FileAccess.Write)
          Dim w As New StreamWriter(fs)
          Dim sr As IO.StreamReader = IO.File.OpenText(&quot;a8.txt&quot;)
          While sr.Peek &lt;&gt; -1
              Dim Strinput As String
              Strinput = sr.ReadLine
              Dim input = Strinput.Split(&quot;,&quot;)
              Dim age As Double = Val(input(3))
              Dim SD = CalcSD(age)
              Dim Tax = CalcTaxable(SD, age, Strinput)
              w.WriteLine(&quot;Name: &quot; &amp; input(0))
              w.WriteLine(&quot;Taxable Income:&quot; &amp; Tax)
              w.WriteLine(&quot;Age:&quot; &amp; input(3))
              w.WriteLine(&quot;Program Completed&quot;)
              MsgBox(&quot;Program Completed!&quot;)
          End While
  
          sr.Close()
          w.Close()
      End Sub
      Function CalcSD(ByVal age As Integer) As Double
          Dim SD As Double
          If age &gt;= 65 Then
              SD = 17500
          Else
              SD = 12500
          End If
          Return SD
      End Function
      Function CalcTaxable(ByVal SD As Double, age As Double, strinput As String) As Double
          Dim sr As IO.StreamReader = IO.File.OpenText(&quot;a8.txt&quot;)
  
          Dim sum As Double
          strinput = sr.ReadLine
          Dim Input() = strinput.Split(&quot;,&quot;)
          Dim name As Double = Val(Input(0))
          Dim income As Double = Val(Input(1))
          Dim contribution As Double = Val(Input(2))
          sum = income - contribution - SD
  
          Return sum
      End Function
  End Class
  </code></pre>