I need help with some VB code. I will keep it generic and clear as possible.
I have two forms lets call Form1 and Form2
I have a class module (CM) and a sub class module (SCM) instantiated in the upper module
CM
|_> SCM
Form 2 loads first and accesses SCM through CM
(everyting OK at this point)
Form 2 calls Form1 which tries to access SCM while Form2 still communicating
to the CM.
Here is the relevent code for Form2:
Private CM_ref As CM
(note everything in Form2 is able to communicate to theCM no problems)
Call Form1.Sub
Here is the relevent code for Form1:
Private Sub Form_Load()
CM_ref.String1 = "String"
(note this is when I receive an invaid use of property error)
End Sub
Public Property Get CM_ref() As CM
Set CM_Ref= CM
End Property
Public Property Let CM_ref (ByRef b As CM)
CM_ref = b
End Property
Here is the relevent code for the CM:
Private m_SCM As clsSCM
Public Property Get SCM() As clsSCM
If m_SCM Is Nothing Then
Set m_SCM = New clsSCM
End If
Set SCM = m_SCM
End Property
Public Property Get String1() As UserDefinedStringType
String1 = SCM.String
End Property
Public Property Let String1(ByVal n As UserDefinedStringType)
SCM.String = n
End Property
Here is the relevent code in SCM:
Private m_String As UserDefinedStringType
Public Property Get String1() As UserDefinedStringType
String1 = m_String
End Property
Public Property Let String1(ByVal int As UserDefinedStringType)
String = int
End Property
Help: What I want to have happen it when Form1 is called and loads,
for Form1 to create a reference to SCM to access it's functions not to
create a new instance of SCM. It should be able to communicate while
Form2 has access to CM.SCM also both would have access to Functions and
update property values that the other form would then see. Any help
or advice would be greatly appreciated. let me know if you need any
other information to figure out what I'm doing wrong to generate this error.