我試圖將frmMain上的文本框的值傳遞給frmDepartment上的文本框。我已經嘗試了下面的代碼,我認爲它會起作用,但它不適用。我爲VB創建了一個新用戶,並且來自php背景,這將成爲設置seeion的簡單任務。有人能幫忙嗎?如果您需要查看更多代碼,請詢問。非常感謝vb2010將數據從一種表單傳遞到另一種表單
txtDeptCustomer.Text = frmMain.txtCustomerActive.Text
在frmMain,我得到的值是這樣的:
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
該圖是frmMain確定。
在frmDepartment我有這樣的代碼
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
我們需要更多的代碼。 –
你的意思是「它不起作用」 –
這兩個表單是否在同一時間運行? –