title: vb2010 pass data from one form to another
body: <p>I am trying to pass a value of a textbox on frmMain to a textbox on frmDepartment. I have tried the following code which I thought would work but it dosen't. I ma a new user to VB and come from a php background where it would have been a simple task of setting a seesion. Can anyone help with this? If you need to see more code, please ask. many thanks</p>
  
  <pre><code>txtDeptCustomer.Text = frmMain.txtCustomerActive.Text
  </code></pre>
  
  <p>In frmMain, I am getting value like this:</p>
  
  <pre><code>Dim value As Object = UserDataGridView.Rows(e.RowIndex).Cells(0).Value
  txtCustomerActive.Text = CType(value, String)
  
  Private Sub btnDepts_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDepts.Click
          frmDepartment.Show()
  End Sub
  </code></pre>
  
  <p>Which is showing in frmMain ok.</p>
  
  <p>In frmDepartment I have this code</p>
  
  <pre><code>Private Sub txtDeptCustomer_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDeptCustomer.TextChanged
      'Dim customer As String
  
      txtDeptCustomer.Text = frmMain.txtCustomerActive.Text
  End Sub
  </code></pre>