Solved

default values for properties.

Posted on 2002-03-06
2
220 Views
Last Modified: 2013-11-23
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.
0
Comment
Question by:AlfaNoMore
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Author Comment

by:AlfaNoMore
ID: 6844466
I HATE THAT!!!!

Just posted this question, and IMMEDIATELY found the solution!!!

Private Sub Class_Initialize()
   mvarValue = 0
End Sub

I'll get this deleted then...
0
 
LVL 1

Accepted Solution

by:
Moondancer earned 0 total points
ID: 6844509
Don't hate it, it's great.  You posted a question and added the solution, this could help others.  I refunded the 50 points to you and will move to the PAQ at zero points to close it.

Thanks,

Moondancer
EE Moderator
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Hide vba in gp 7 114
firemonkey keyboard covers the controls 1 51
VBA - If Bookmark = "XXBOOKMARKXX" then 15 50
Powerpoint 2013: Change cell reference in excel link 3 121
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question