Controls, Properties, and Procedures 090500
VB Coding Code colors Commenting Procedures (Subroutines and Functions) Objects: Controls
Code Colors Black – General coding, Objects Blue – Keywords Green - Other
Commenting Add comments (start line with an apostrophe) to EXPLAIN EVERY SECTION OF CODE. Comments are great ways to quickly hide unwanted code from the computer.
Procedures A procedure is a section of code that performs a specific task A subroutine is a procedure. Events call subroutines. Your program may also call a subroutine. A function is a procedure that returns a value. Subroutines that contain formulas that return values are functions.
Many Functions are Built-in Cint(MyNumber) Len(MyWord) Many Others
Calling Subroutines and Procedures Sub Procedure: Call MySubroutine() MySubroutine() Functions: MyCircumference=MyCircle(myRadius)
Objects: Controls Controls are objects. Objects have properties and procedures (called methods) associated with them. cmdButton1.Text = “My Button” lstColors.Items.Add “Red” A method is a procedure that acts on the object that calls it. Above, the list control called the Add method.
Review Control Procedure Function Subroutine Event Method Property