Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Sharing information between classes

I'm new to using class modules and was wondering how to do the
following

I have a class module called DeviceList, which contains

Private m_strListName As String
Private m_lbLinkButton As LinkButton
Property Get AddButton() As LinkButton
Set AddButton = m_lbAddButton
End Property
Property Set AddButton(lbLinkButton As Object)
Set m_lbAddButton = lbLinkButton
End Property
Property Get ListName() As String
ListName = m_strListName
End Property
Property Let ListName(ByVal strNewValue As String)
' Raise an error if an invalid assignment is attempted.
If Len(strNewValue) = 0 Then Err.Raise 5
m_strListName = strNewValue
End Property

I was wondering if there was a way to directly access ListName
directly from the LinkButton module using something like myVar =
Me.Parent.ListName. This doesn't work, but there must be some way of
accessing the parent object instance's properties and methods right?

Thanks for any forthcoming help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Sharing information between classes

You just need to give your LinkButton class a DeviceList object variable and
a Parent property that sets and returns references to that object.

Private mobjParent As DeviceList

Public Property Set Parent(ByRef objNewValue As DeviceList)
Set mobjParent = objNewValue
End Property

Public Property Get Parent () As DeviceList
Set Parent = mobjParent
End Property

You then need to initialize the LinkButton object's Parent property when you
create it. After that you can reference any public DeviceList method or
property from within the LinkButton class using either the mobjParent object
variable directly or through the LinkButton Parent property as in your
request.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm

"jrpfinch" wrote in message
...
I'm new to using class modules and was wondering how to do the
following

I have a class module called DeviceList, which contains

Private m_strListName As String
Private m_lbLinkButton As LinkButton
Property Get AddButton() As LinkButton
Set AddButton = m_lbAddButton
End Property
Property Set AddButton(lbLinkButton As Object)
Set m_lbAddButton = lbLinkButton
End Property
Property Get ListName() As String
ListName = m_strListName
End Property
Property Let ListName(ByVal strNewValue As String)
' Raise an error if an invalid assignment is attempted.
If Len(strNewValue) = 0 Then Err.Raise 5
m_strListName = strNewValue
End Property

I was wondering if there was a way to directly access ListName
directly from the LinkButton module using something like myVar =
Me.Parent.ListName. This doesn't work, but there must be some way of
accessing the parent object instance's properties and methods right?

Thanks for any forthcoming help.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Sharing information between classes

That's great thank you very much

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Workbooks Sharing Information bodhisatvaofboogie Excel Programming 4 May 26th 06 02:09 PM
Formula help on information sharing between 3 worksheets Macmo Excel Discussion (Misc queries) 7 May 13th 06 04:50 PM
Sharing information between workbooks nadia New Users to Excel 3 February 11th 06 08:13 PM
Sharing Information Between Workbooks Tim Excel Worksheet Functions 0 September 25th 05 07:00 PM
Sharing information between Access and Excel C.M. Warden Excel Discussion (Misc queries) 1 March 16th 05 12:38 PM


All times are GMT +1. The time now is 11:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"