What is the difference between a property a method and an
event? Give an example of each.
Answers were Sorted based on User's Feedback
Answer / pratap557
Property are a type of method that shows state of an Object
like Caption, backcolour etc.
Methods/Functions are for changing Or doing something on
the Object Like Move,Remove, Add etc.
Event are Objects which means that something happend for
which the object must respond to. And for this very reason
we write method like
button1_Click( sender Object, event Object)
The event Object(Delegate) is related with the method of
that responder Object(Button)
Is This Answer Correct ? | 176 Yes | 30 No |
Answer / gaurav
Object has three characteristics
and these are
1.Property
2.Method
3.Event
Property represents (data) characteristic of an object..
Method represents the behavior(action)performed by an object..
Event is msg sent by an object to signal an activity
Example:-
For a class Employee
FirstName,LastName,Salary <------ Properties
Hire,Promote <------ Methods
On hire, On promote <------ Events
Is This Answer Correct ? | 92 Yes | 8 No |
Answer / amir
A property indicates the state of object. Eg. Visible =
True.
A method is a used for changing the state of object.
An event is a feedback of object state change. An event is
triggered when the object state is changed.
Is This Answer Correct ? | 82 Yes | 37 No |
Answer / ashwini khopkar
Property:-
1) It tells something abt an object, such as its
name,color,size,location,or how it'll behave.
2) We can thing property as adjectives that describe
objects.
3) For e.g., Caption property of a form are called as
Form1.caption.
Method:-
1) Actions associated wid objects are called as method.
2) Methods are verb.
3) Some typical methods are move, print, resize & clear.
Event:-
1) Code related 2 some objects.
2) It is also verb.
3) It is an action that may b taken by d usr, such as
click, drag, key press, or scroll.
Is This Answer Correct ? | 30 Yes | 10 No |
Answer / manish mehta
Object has three characteristics
and these are
1.Property
2.Method
3.Event
Property represents (data) characteristic of an object..
Method represents the behavior(action)performed by an object..
Event is msg sent by an object to signal an activity
Example:-
For a class Employee
FirstName,LastName,Salary <------ Properties
Hire,Promote <------ Methods
On hire, On promote <------ Events
Is This Answer Correct ? | 24 Yes | 6 No |
Answer / kunal yagnik
Methods and properties basically both are functions defining
different states if we relate them to real world.Both are
defined in a class and the procedure to execute them is a
bit different but this is only done to make the code more
transparent and visible.To understand this look the example
below :
He can walk,talk,run,write are methods while He is
sweet,soft spoken,fair are properties.
We will get the closer look if we try to implement these on
working code.
Is This Answer Correct ? | 30 Yes | 21 No |
Answer / kunal yagnik
while an event always happens with respect to time eg: when
this button clicked then the box will display this click
happens with respect to time so this is event (a button click)
Is This Answer Correct ? | 19 Yes | 13 No |
Answer / nitesh
when you will click on radio button below (e. g. yes ) that
will generate an event. when the respected ouput will be
generated (i. e. incrementing no. of yes), that is caused by
the method. And the color (i.e. Green / red) of radio button
is set due to use of property.
....Nitesh Singh
Is This Answer Correct ? | 7 Yes | 1 No |
Answer / 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 |
Answer / anuradha
Property:
It is the inbuilt behaviour.
Mehtod:
It is the work that is possible to perform
Event:
It is the result of the work performed.
Ex::
A man
Man has two hands, two legs , he is fair , handsome etc are
the Properties
Walking , claping , writing are the possible things done by
the man, and they are treated as Methods.
If he walks will go to some place, if he writes will
complete his homework i.e; if he done some work he will get
the result
Means the execution of method is called as Event(will get
some output)
Is This Answer Correct ? | 1 Yes | 0 No |
How do I mimic a toggle button?
___ argument can be used to make a menuitem into bold.
What is Pseudocode?
Explain the types of Views in Listview Control.
What is Mixed Cursors?
When/Why should I use Option Explicit?
How would you find out the value property in Slider Bar Control?
Does VB support object-oriented concepts? Explain..
It is possible to access Text (x.txt) files? Explain.
What two methods are called from the ObjectContext object to inform MTS that the transaction was successful or unsuccessful?
How will you define a function to accept optional arguments?
Where can I get updated VB and other Microsoft files?