mgmhicks
asked on
pass values between vb.net forms
I have a form that calls another form. I can a variable in form2 before calling the showdialog on the form2 and it uses it in code in form 2. However I would like to pass a value back to the callingform but that seems to be a no go. I have enclosed the code to call form2 and the code that is supposed to update a variable on form1 before going back to the code. Please checkout and let me know why myQty variable is 0 when I return from form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myKeyboard As New frmKeyboard
Dim mQty As Integer = 0
myKeyboard.mKeyType = 2
myKeyboard.mItemDesc = Button1.Text
myKeyboard.ShowDialog()
FillListBox(Button1.Text, Button1.Tag, myQty)
End Sub
Private Sub cmdEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEnter.Click
FrmInspection.myQty = CInt(txtQty.Text)
Me.Close()
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Where are you declaring and setting FrmInspection?
Cheers,
Randy