Guidelines for Entering and Editing Code
You enter and edit code in the Code window The Code window has automatic formatting and syntax checking capabilities built in. If the syntax checker is turned on, Visual Basic displays a message when you enter code that has a syntax error..
Using the Code Window
To enter code, click the Code window and start typing.
To correct mistakes as you type, press Backspace.
To delete text, select it and press Del.
To move the insertion point , click where you want the insertion point to be, or use the Arrow keys.
To indent text, select the line or lines you want to indent, and press Tab. To remove an indent, press Shift+Tab.
To switch between insert mode and overtype mode, press Ins.
To enter a comment in your code, start the comment with an apostrophe ( ' ).
To complete a Visual Basic statement , press Enter at the end of the line or move the pointer off the line.
To write multiple statements on one line, use a colon (:) as a separator. For example: For I = 1 to 100: A(I) = I: Next I
To view two procedures at a time, split the window by moving the split bar down the side of the Code window.
To accept arguments in a procedure, separate the arguments by commas if there is more than one, and enclose all the arguments in parentheses following the name of the procedure. For example, Sub IncrementXY(X, Y).
To pass arguments to a procedure, separate the arguments by commas if there is more than one, following the name of the procedure being called. For example, IncrementXY X, Y. Enclose the arguments in parentheses following the procedure name only if the the Call keyword is being used before the procedure name. For example, Call IncrementXY(X, Y).
To get Help on syntax for Visual Basic functions, statements, properties , events , or methods while working in the Code window, type or select the keyword, the property, event, or method name, and press F1.
Declarations and Variables
To make an assignment of one variable to another, use the syntax destination = source.
To name a variable , begin the name with a letter and use no more than 40 letters and numbers.
Attaching an Event Procedure to a Form or Control
Creating a General Procedure
Entering Declarations in Code
Chapter 2, "Your First Visual Basic Application"
Chapter 6, "Programming Fundamentals"
Chapter 7, "Variables, Constants, and Data Types"