Glenn Adams [MVP - Retail
Guest
|
Posted:
Fri Nov 11, 2005 1:03 am Post subject:
Re: Passing Ref to QSRules to Form |
|
|
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
--
--
Glenn Adams
Tiber Creek Consulting
http://www.tibercreek.com
glenn@tibercreek.com
----------------------------------------------
Please DO NOT respond to me directly but post all responses here in the
newsgroup so that all can share the information
"John" <John@microsoft.discussions.com> wrote in message
news:%23eXVhij5FHA.2484@TK2MSFTNGP09.phx.gbl...
| Quote: | 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
|
|
|