title: trouble calling a method in form 2 from a button click on form 1, vb.net
body: <p>I have a program for creating a time sheet and when a saved time sheet is loaded by clicking a button on form 1 the data loads to form 2 and then calls a method in form 2 to print the data to form 3. The problem is after the call <code>Form2.Print()</code> there is no data on form 2 if i open it but still works in that the data is printed to form 3. If I remove <code>Form2.Print()</code> the data is loaded on form 2 and i can then click the Print button and if i open form 2 again the data is still in the text boxes. NOTE: Ideally I would just send the data to form 2 and form 3 from the Open button click event on form 1 but the <code>Print()</code> method on form 2 does many things to the program other than just printing making it easier to just call it instead of replicating it in the Open click. Thank You in advance for the help. Cheers!  </p>
  
  <p>Form 1 <code>Code</code></p>
  
  <pre><code>    Private Sub Open_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Open.Click
          Dim xmldoc As XmlDocument
          Dim nodelist As XmlNodeList
          Dim node As XmlNode
          Dim objForm2 As Object = Form2 
  
          xmldoc = New XmlDocument()
          xmldoc.Load("C:\time.xml")
          nodelist = xmldoc.SelectNodes("/Timesheet/Job1")
  
          For Each node In nodelist
              Dim CustName = node.ChildNodes.Item(0).InnerText
              Form2.txtbxCustName.Text = CustName
              Dim WO = node.ChildNodes.Item(1).InnerText
              Form2.txtbxWONum.Text = WO
          Next
  
          objForm2.Print()
      End Sub
  </code></pre>
  
  <p>`</p>
  
  <p>Form 2 <code>Code</code></p>
  
  <pre><code>    Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
          Print()
      End Sub
  
      Public Sub Print()
          Form3.labelCustName.text = txtbxCustName.text
          Form3.labelWOnum.text = txtbxWOnum.text
          Me.Close()
      End Sub
  </code></pre>