AlfaNoMore
asked on
default values for properties.
I'm sure this is really easy, but I'm not totally up on my VB knowledge, so would liek to know how I can declare lots of global variables, give them aa default values, and then have LET/ GET property declarations to override the defaults?
This is what I have so far:
Dim mProdCode As String
Dim mItemName As String
Dim mManufacturer As Integer
Dim mCollection As Integer
Dim mCategory As Integer
Dim mMaterial As Integer
Dim mCurrPage As Integer
Public Property Get ProdCode() As String
ProdCode = mProdCode
End Property
Public Property Let ProdCode(ByVal vNewValue As String)
mProdCode = vNewValue
End Property
Public Property Get ItemName() As String
ItemName = mItemName
End Property
Public Property Let ItemName(ByVal vNewValue As String)
mItemName = vNewValue
End Property
Public Property Get Manufacturer() As Integer
Manufacturer = mManufacturer
End Property
Public Property Let Manufacturer(ByVal vNewValue As Integer)
mManufacturer = vNewValue
End Property
Public Property Get Collection() As Integer
Collection = mCollection
End Property
Public Property Let Collection(ByVal vNewValue As Integer)
mCollection = vNewValue
End Property
Public Property Get Category() As Integer
Category = mCategory
End Property
Public Property Let Category(ByVal vNewValue As Integer)
mCategory = vNewValue
End Property
Public Property Get Material() As Integer
Material = mMaterial
End Property
Public Property Let Material(ByVal vNewValue As Integer)
mMaterial = vNewValue
End Property
Public Property Get CurrPage() As Integer
CurrPage = mCurrPage
End Property
Public Property Let CurrPage(ByVal vNewValue As Integer)
mCurrPage = vNewValue
End Property
I've had a look at stuff on Constructors, but can't see this applying to this, as ultimately this will be a COM object.
This is what I have so far:
Dim mProdCode As String
Dim mItemName As String
Dim mManufacturer As Integer
Dim mCollection As Integer
Dim mCategory As Integer
Dim mMaterial As Integer
Dim mCurrPage As Integer
Public Property Get ProdCode() As String
ProdCode = mProdCode
End Property
Public Property Let ProdCode(ByVal vNewValue As String)
mProdCode = vNewValue
End Property
Public Property Get ItemName() As String
ItemName = mItemName
End Property
Public Property Let ItemName(ByVal vNewValue As String)
mItemName = vNewValue
End Property
Public Property Get Manufacturer() As Integer
Manufacturer = mManufacturer
End Property
Public Property Let Manufacturer(ByVal vNewValue As Integer)
mManufacturer = vNewValue
End Property
Public Property Get Collection() As Integer
Collection = mCollection
End Property
Public Property Let Collection(ByVal vNewValue As Integer)
mCollection = vNewValue
End Property
Public Property Get Category() As Integer
Category = mCategory
End Property
Public Property Let Category(ByVal vNewValue As Integer)
mCategory = vNewValue
End Property
Public Property Get Material() As Integer
Material = mMaterial
End Property
Public Property Let Material(ByVal vNewValue As Integer)
mMaterial = vNewValue
End Property
Public Property Get CurrPage() As Integer
CurrPage = mCurrPage
End Property
Public Property Let CurrPage(ByVal vNewValue As Integer)
mCurrPage = vNewValue
End Property
I've had a look at stuff on Constructors, but can't see this applying to this, as ultimately this will be a COM object.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Just posted this question, and IMMEDIATELY found the solution!!!
Private Sub Class_Initialize()
mvarValue = 0
End Sub
I'll get this deleted then...