Objects, Properties and Methods

Objects consist of code and data that work together as a unit. Data is stored in an object in the form of Properties. Properties are attributes or characteristics that control an objects appearance or behavior. BackColor, ForeColor, Width, Font, and Text are all Properties of an object. You can think of a Property as an adjective that describes an object

Objects also contain code in the form of Methods. Methods are procedures that contain instructions that the control can execute. You can think of Methods as actions that an object is capable of performing.

A textbox is capable of clearing the contents of its Text property or capturing the Focus of the form by using the Clear and Focus methods.

A Form is capable of removing itself from memory by using it's Close method.

To reference any member, Property or Method of an object we use the dot operator. The statement

txtName.Clear

will cause the contents of the object txtName to erase the contents of it's Text property.

To set focus to an object in code we can

txtName.Focus

To close a form we

Me.Close

NOTE: When referring to a Form within that Form's class module (in other words when a Form refers to itself) we must use the Me operand.