Need some help on passing data back and forth between open forms on two different classes. I have a class that I call from the Main… when I call the class I call a sub that opens a form. On the form I have a button that calls another class that opens a form so I can select a company from a data grind. But I can’t return values to the class that called it. Says I need to initialize it again.
I am trying to call sub from the class that called the open form and class. If that makes sense..
Here is the call from the main code
Here is the sub that opens
Here is the code for the button click on frmMemberkey
Here is the code I am running on the ok button click
I can pass the data back to a sub Main.CallCompanySelect(arow(0), arow(1), arow(2)) with no issues. when called from the main code. But when I try to pass it back to the class that called the form.. k.CallCompanySelectMMK(arow(0), arow(1), arow(2)) and it does not work.
I haven’t found anything like raising an event .. does anybody have any ideas…
I am trying to call sub from the class that called the open form and class. If that makes sense..
Here is the call from the main code
B4X:
Sub GenMemKey_Action
Dim k AsKeyMgr
k.Initialize
k.ShowMemberKey(MainForm)
EndSub
Here is the sub that opens
B4X:
PublicSub ShowMemberKey(FormOwner AsForm)
MemberKeyForm.Initialize("frmMemberkey",322,176)
MemberKeyForm.SetFormStyle("UTILITY")
MemberKeyForm.Resizable = False
MemberKeyForm.BackColor = fx.Colors.LightGray
MemberKeyForm.RootPane.LoadLayout("frmMemberkey")
MemberKeyForm.SetOwner(FormOwner)
MemberKeyForm.Show
EndSub
Here is the code for the button click on frmMemberkey
B4X:
Sub btMmkCompSelect_MouseClicked (EventData AsMouseEvent)
'getting company
Dim c As clsCompanySelect
c.Initialize(Main.strMKDirLoc, Main.strMMDirLoc, MemberKeyForm)
c.GetCompany(MemberKeyForm, "MemberKeyForm")
EndSub
Here is the code I am running on the ok button click
B4X:
Sub btCSOK_MouseClicked (EventData AsMouseEvent)
Dim arow(3) AsObject = tblCS.SelectedRowValues
If strFormName = "MainForm"Then
Main.CallCompanySelect(arow(0), arow(1), arow(2))
EndIf
If strFormName = "MemberKeyForm"Then
Dim K AsKeyMgr
K.Initialize
k.CallCompanySelectMMK(arow(0), arow(1), arow(2))
EndIf
cs.close
EndSub
I can pass the data back to a sub Main.CallCompanySelect(arow(0), arow(1), arow(2)) with no issues. when called from the main code. But when I try to pass it back to the class that called the form.. k.CallCompanySelectMMK(arow(0), arow(1), arow(2)) and it does not work.
I haven’t found anything like raising an event .. does anybody have any ideas…