Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the difference between a property a method and an
event? Give an example of each.

Answer Posted / chris barry

There is very little difference between VBA methods and
properties. A property is not analagous to a Java field, it
executes a class procedure just as a method does. The main
difference is that a property can be the left side of an
assignment.
Class methods are defined using the Function and Sub
keywords just as they would be used outside a class. User
defined properties use the Property key word together with
Get, Set or Let. A "Property Get" procedure seems almost
indistinguishable from a "Function" except that if there is
a corresponding "Property Let" then the compiler may check
that the type returned by "Get" is the same as the type
accepted by Let.
A "Property Let" procedure is defined as a normal function
with at least one argument, but it is called with one
argument fewer. The final argument takes its value from the
right side of the assignment. e.g.

Dim arr(4) As Integer
Property Let element(idx, val)
arr(idx) = val
End Property

could be called as:

ClassName.element(1) = 2

An event is something that happens asynchronously to the
main thread of the application, which can be linked to a
user-defined procedure (an event handler) which will be
invoked when the event occurs. In VBA at least, events are
most commonly generated by controls responding to user
actions.

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I implement an incremental search in list/dir/combo/file boxes?

1369


How can I access a record by record number?

1475


Is it posible to Create Tables Through Querydef?

2017


Which method is preferred to save data like database to the disk?

2327


How do I change the color of a form in visual basic?

900


What is difference between datagrid and flexgrid?

13792


How would you add elements in TreevieW Control.

2108


Explain about Caturing Baseline.

1068


How many ways we can access file using VB?

2157


Explain OLE Drag and Drop?

2407


What is dao in vb?

886


What is instantiating?

1822


Difference between DDE and OLE.

3244


How do I set the Windows wallpaper at runtime?

1532


How would you use ActiveX Dll and ActiveX Exe in your application?

2339