Solved

usage of Property function

Posted on 2002-07-18
2
172 Views
Last Modified: 2010-05-02
Hi

I want to know how to utilize the Property Function.
eg,

Public Property Let AppVersion(sVersion as String)
   lblAppVersion = sVersion
End Property

Where lblAppVersion is a Label control in a form.

What is the above statement trying to achieve ?
I mean, is it like a function or procedure where
we need to call it somewhere in our code.

Pls advice.

Thanks & Rgds
Heng03







0
Comment
Question by:heng03
2 Comments
 

Accepted Solution

by:
Amitabh earned 50 total points
ID: 7164109
you can use property procedures to assign(let) or fetch(get) values from your component.

Suppose you make a component(e.g a dll) "customer" and now you don't want the user to have access to the variable "name" which u r using inside your component at many places. Now what u can do is to add a property cust_name. you must be knowing how to do that...just go to tools -> procedure and add property. give name as cust_name.

soon you will see two procedures let and get in ur window. now when u will make a object of ur component customer like this.

dim myobj as new customer

myobj.cust_name="David"
As soon as u say the above let property procedure is called and it assigns "name" the value "David"

similarly when you say
Text1.text=myobj.cust_name

Get is called and the value stored in variable "name" is fetched.

hope this helps you.
0
 

Author Comment

by:heng03
ID: 7164166
Hi Amitabh

Thanks for your answer.
It is clear to me now.

Rgds
Heng03
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

776 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