Passing Ref to QSRules to Form

Nov 10, 2005 1 Replies

I have created a custom dll that fires from a Custom POS Button. I have been able to pass a reference of the QSRules object to a Public Sub on a Form and within the Form been able to access some of the properties and methods of the QSRules. My question is how can I now make the Ref to the QSRules available to a command button. When I fire an event from the Form the Object is nolonger pointing the the SessionClass. Am I close with this or completely out to lunch?



'Entry point fired by Custom POS Button Public Function Process(mySession As Object) As Boolean Process = True Dim s As New Form1 s.Session mySession End Function


' form1 Dim m_QSRules As SessionClass



Private Sub Command1_DblClick() 'This Does not fire, throws error MsgBox m_QSRules.Cashier.Name End Sub


Public Sub Session(ByRef NewSession As SessionClass) Set m_QSRules = NewSession If m_QSRules Is Nothing Then MsgBox "didn't work" Else 'THIS fires successfully everytime MsgBox m_QSRules.Cashier.Name End If End Sub



John


Instead of having a Sub called "Session", make that a PROPERTY

in dll:

Public Function Process( mySession as Object) as boolean 'Create the form....

set form1.Session = mySession

' Show the form...

end Function

in form 1:

private m_QSR_Session as Object

public property set Session(o as object) set m_QSR_Session = o end property

private sub myBtm_Click(...)

m_QSR_Session.Cashier.Name

end sub

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required