Code Window

See Also6TLMDZ

 

Use the Code window to write, display and edit code.  You can open as many Code windows as you want, so you can easily view the code in different forms and modules and copy and paste between them.

         To open a Code window from the Project window183GH18, select a form or module name and choose the View Code button.  Choose the View Form button to see the form.

         To open a Code window from a Form windowVK6SGD, double-click a controlXX9KJT or the form itself, or choose Code (F7) from the View menu.

 

The Code window includes:

         The Object box.  For forms, the Object box lists the current form and all the controls on the current form.

         The Procedure box.  If you are editing form code, the Procedure box lists all the events recognized by Visual Basic for the form or control displayed in the Object box.  When you select an event, either the event procedure associated with that event name, or a code template for the event, is displayed in the bottom part of the Code window.

     If (general) is displayed in the Object box, the Procedure box lists all of the general proceduresKK8N1J that have been created for the form.  If you are editing module code, the Procedure box lists all of the general procedures in the module.  In either case, the procedure you select in the Procedure box is displayed in the bottom part of the Code window.

         The Split bar.  The Split bar is located across the window, below the title bar at the top of the vertical scroll bar.  Dragging this bar down splits the Code window into two horizontal panes, each of which scrolls separately.  You can then view different parts of your code at the same time.  The information that appears in the Object box and Procedure box applies to the code in the pane that has the focus.  Dragging the bar to the top of the window closes a pane.

 

Note   If you need help on syntax for functions, statements, properties, events, or methods while working in the Code window, type the keyword or the property, event, or method name, and press F1.  You can also select an event in the Procedure box and press F1 for information about the selected event.

 


See Also

Help:

Attaching an Event Procedure to a Form or Control2LBGK4C

Entering Declarations in Code1AS3HT9

Guidelines for Entering and Editing Code5SZA0GX

 

Learning Visual Basic:

How Visual Basic Works

 

Programmer's Guide:

Chapter 2, "Your First Visual Basic Application"