There's probably something simple that I'm missing, but I was to make a class with a class(es). I'd like to be able to use my class so that I can dot (.) into subsequent classes. But, I want the subsequent classes to still be able to use the functions, subs, and variables from the original class. I also want to be able to call functions and subs in subsequent classes.
This is dummied up, but it's a simplified example of what I'm trying to do. Actual code is a few hundred lines.
With this format, I get an error "Reference to a non-shared member requires an object reference." I tried sharing the functions, which gets rid of the error, but still doesn't seem to work. I also had my the top level class dim an the secondary class as new, and the secondary class dim the top level class. All I really want to do is to organize my class so that I don't have class1.50+ItemsToChooseFrom. Instead I have a class with say 15 items.. and some of those items have sub-items.
Thanks for any help.
This is dummied up, but it's a simplified example of what I'm trying to do. Actual code is a few hundred lines.
Code:
Sub DoStuff()
Dim Blah As New Class1
Blah.SetVar
Blah.Class2.ParseVar
Blah.Class2.NewVar
End Sub
Public Class Class1
Public Function SetVar() As String
SetVar = "abcdef"
End Function
Public Sub SetThisValue()
Dim ThisValue As String
ThisValue = Class2.NewVar
End Sub
Public Class Class2
Public Sub ParseVar()
Dim aArray
aArray = Split(SetVar)
End Sub
Public Function NewVar() As String
NewVar = "123456"
End Function
End Class
End Class
With this format, I get an error "Reference to a non-shared member requires an object reference." I tried sharing the functions, which gets rid of the error, but still doesn't seem to work. I also had my the top level class dim an the secondary class as new, and the secondary class dim the top level class. All I really want to do is to organize my class so that I don't have class1.50+ItemsToChooseFrom. Instead I have a class with say 15 items.. and some of those items have sub-items.
Thanks for any help.