title: Display FileName as Title on ChildForms
body: <p>At the moment when a child form opens it is given a document number. Which is fine, But i want to then change the document number to show the name the file has been saved by. I attempted to make a CurrentFile function but that was only working for SDI not MDI forms and displayed only on Parent Form.</p>
  
  <pre><code>Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click
      ' File, New command
      NewChildCount += 1
      Dim NewChild As New Document()
      NewChild.MdiParent = Me
      NewChild.Text = "Document " &amp; NewChildCount.ToString
      NewChild.Show()
  End Sub
  
  Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
      ' File, Open menu command.
      Dim sr As StreamReader
      OpenFileDialog1.FileName = ""
      OpenFileDialog1.Filter = "Text Files *.txt | *.txt"
      If OpenFileDialog1.ShowDialog = DialogResult.OK Then
          Try
              sr = File.OpenText(OpenFileDialog1.FileName)
              Dim newDoc As New Document()
              newDoc.RichTextBox1.Text = sr.ReadToEnd
              sr.Close()
              newDoc.Text = OpenFileDialog1.FileName
              newDoc.MdiParent = Me
              newDoc.Show()
              newDoc.isNamed = True
              'CurrentFileName()
              ' Move cursor to the start of the document.
              With newDoc.RichTextBox1
                  .Select()
                  .SelectionStart = 0
                  .SelectionLength = 0
              End With
          Catch ex As Exception
              MsgBox("There was an error opening the file.")
          End Try
  
      End If
  
  End Sub
  
  Private Sub SaveDocument(ByVal doc As Document, ByVal FileName As String)
      Try
          Dim sw As New StreamWriter(FileName)
          sw.Write(doc.RichTextBox1.Text)
          sw.Close()
          doc.isNamed = True
          doc.isDirty = False
      Catch ex As Exception
          MsgBox("There was an error saving the file.")
      End Try
  End Sub
  </code></pre>