default value for class module

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear all,

I just started to learn to use class module. I am trying to figure out how
to set up a default value for some of the parameteres. Can you guys give me
a simple example? Thanks a million!

chun
 
Easiest way is to use the Class_Initialize procedure to set default values
for the desired variables/properties within the class.
 
You mean I should assign default values first (initializing) in a regular sub
before using it? Thanks.

chun
 
I believe what Ken's suggesting is that you provide the default values in
the class's Initialize Event.

Private lngProperty1 As Long
Private strProperty2 As String

Private Sub Class_Initialize()

lngProperty1 = 15
strProperty2 = Sell

End Sub

Public Property Get Property1 As Long

Property1 = lngProperty1

End Property

Public Property Get Property2 As String

Property2 = strProperty2

End Property
 
Douglas J. Steele said:
I believe what Ken's suggesting is that you provide the default values in
the class's Initialize Event.


Yes, that is what I am suggesting < g >.
 
Back
Top