compguru910
Well-known member
- Joined
- Nov 25, 2009
- Messages
- 47
- Programming Experience
- 3-5
Ok, so heres my issue. Im loading a form to retrieve customer information from one form, then, when I collect the data, im trying to pass an ID back to the form that originally made the call. So, what I did is I made it so that the second form calls a sub on the first form, but for some reason it wont work. I put breakpoints in to check the variables, and they are getting data, but I can set the textbox on the first form with the data that is in the sub. Heres the code that loads the second form
Here is the code that returns the id to the first form
And here is the sub that is supposed to return a name to the textbox.
Thanks in advance for the help
VB.NET:
Private Sub btnCustSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCustSearch.Click
Dim strLastName As String
Dim strFirstName As String
strLastName = txtLastName.Text
strFirstName = txtFirstName.Text
Using fCustomerLookup As New frmCustBrowser
fCustomerLookup.strLastName = strLastName
fCustomerLookup.strFirstName = strFirstName
fCustomerLookup.ShowDialog()
End Using
End Sub
Here is the code that returns the id to the first form
VB.NET:
Private Sub btnSelectCustomer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelectCustomer.Click
MsgBox(dgvCustomer.Item(dgvCustomer.CurrentRow.Index, 0).Value)
frmAddRo.intCustId = dgvCustomer.Item(dgvCustomer.CurrentRow.Index, 0).Value
frmAddRo.RetrieveCustomer(frmAddRo.intCustId.ToString)
Me.Dispose()
End Sub
And here is the sub that is supposed to return a name to the textbox.
VB.NET:
Public Sub RetrieveCustomer(ByVal id As String)
Dim strQuery As String
Dim data As New DataTable
Dim strFirstName As String
strQuery = "SELECT * FROM customer WHERE cust_id = '" & id & "'"
data = dbReturnTable(strQuery)
strFirstName = data.Rows(0).Item(1)
txtFirstName.Text = "3"
End Sub
Thanks in advance for the help