Passing Ref to QSRules to Form
Personal Finance Forum Index Personal Finance
Talk about personal finance: tax, stocks, retirement, funds, and financial software.
Investing Blog
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web pftalk.com
Passing Ref to QSRules to Form

 
Post new topic   Reply to topic    Personal Finance Forum Index -> POS
Author Message
John
Guest





Posted: Fri Nov 11, 2005 1:03 am    Post subject: Passing Ref to QSRules to Form Reply with 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

Back to top
Glenn Adams [MVP - Retail
Guest





Posted: Fri Nov 11, 2005 1:03 am    Post subject: Re: Passing Ref to QSRules to Form Reply with quote

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
Back to top
 
Post new topic   Reply to topic    Personal Finance Forum Index -> POS All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Credit Repair - Personal Finance Directory


AddThis Feed Button
Contact Us
New Topics Powered by phpBB