Performing Actions with Methods
Methods are procedures associated with objects. Unlike fields and properties, which represent information an object can store, methods represent actions that an object can perform. Methods can affect the values of properties. For example, the items of list boxes have a List
property, which you can change with the Clear
and Add
methods.
When you use a method in code, the way you write the statement depends on how many arguments the method requires and whether it returns a value. Generally, you use methods just like you use subroutines or function calls. More specifically, you invoke methods in the same way as module procedures, except that you can qualify methods with an expression specifying the object instance whose method is to be called.