The Code Editor Margin icons From time to time you will see icons appear in the gray margin at the left-hand side of the editor window when the program is in debug mode. These icons are related to the debugging process, and give an indication of what will happen when program execution reaches the corresponding line of code. The meaning of each icon is given below (note that these icons are sometimes combined to indicate the occurrence of a more complex action). Yellow arrow - indicates that program execution has been halted at this line. Red circle - indicates a breakpoint. Hollow red circle - indicates a disabled breakpoint. Red circle with plus sign - indicates a breakpoint with a condition or hit count test. Red diamond - indicates a breakpoint that causes an action to be executed when it is reached. Blue and white rectangle - indicates a bookmark. Line numbers To display line numbers, select Options from the Tools menu, then select the select Basic configuration page under Text Editor, and check the "Line Numbers" box. Outlining The code editor can display an outline view of the code, or sections thereof, to reduce clutter. If you look to the left of the second line of code in the illustration below, you can just make out a minus (-) sign inside a small box at the left-hand side of the code window. If you click the box, the editor collapses the section of code to which it pertains and displays a box with a plus sign instead, and the first line of the collapsed code is partially displayed greyed out, followed by ellipsis and with a rectangle drawn around it. Clicking this box will expand the code once more. Note that comments placed before a subroutine remain visible, even when the subroutine is collapsed. You can make keeping track of collapsed sections of code easier, therefore, by preceding subroutines with an appropriate comment. Tooltips If you move the mouse over a variable while editing code, a tooltip is displayed describing the variable. If the variable was an integer variable named "myInt", for example, the message "Dim myInt As Integer" would appear. In a similar fashion, moving the mouse over a subroutine or function call causes a tooltip to be displayed that gives information about the subroutine or function. In the illustration below, the tooltip for the MsgBox function has been invoked. IntelliSense When entering program code, the editor analyses each line of code as you type it and attempts to make predictions. If you start a line of code with the keyword "Me" followed by a period, for example, the editor will assume that you are about to invoke one of the current object's properties or methods. It will display a list of appropriate properties and methods, allowing you to select the correct one. If you start to type in the name of the property or method, the list of choices will be restricted to match the text entered. In the illustration below, the line of code being typed begins with "Msg". The editor displays several options - the MsgBox object and a number of related properties. After you have typed the name of a function or procedure and its opening parenthesis, the editor displays information about the parameters for that function or procedure. The illustrationbelow shows the parameter information for the MsgBox function. Note that in the parameter list the current parameter is highlighted, and a description of the current parameter is displayed underneath the parameter list. As each parameter is entered, the next parameter is highlighted and its description is displayed. Code highlighting and underlining The code editor highlights various types of code element by displaying them in text of different colours. Green text - signifies a comment. Blue text - signifies a keyword or preprocessor keyword. Purple text - signifies stale code (code superceded by code changes during debugging) . Navy text - signifies a user-defined type. Wavy blue underline - signifies a compiler error. Wavy green underline - signifies a warning. Wavy purple underline - signifies some other type of error. Light gray background - signifies a read-only block of code. The illustration below shows the way in which the editor uses colour coding to identify comments and keywords, and underlines a compiler error in blue (note that the keyword "dblInput" has been mis-typed as "dbInput") . The code editor underlines errors with a wavy line. If you position the mouse pointer over the underlined item, a tooltip is displayed that describes the error. Often, a small rectangle appears to the right of the underlined item that indicates that it can suggest a possible solution. In the first illustration below, the mis-typing of "dblInput" as "dbInput" is interpreted as an undeclared variable, and the suggestion icon is displayed. Clicking on the icon, opens a dialogue box that describes the error, and lists possible remedial actions. As you can see from the second illustration below, discretion must be exercised when using this feature, as the action suggested is not always appropriate. Code Snippets A "code snippet" is a piece of program code that you might want to re-use in other applications. You can store these bits of code in a "snippet library" so that you can find them again quickly. Visual Studio comes with an large number of code snippets for performing common tasks, so it is worth browsing through the existing libraries before you start work on a project to see if there is any existing code that you can use. To insert a snippet, right-click the point where you wish to insert the snippet, and select Insert Snippet from the pop-up menu. Double-clicking a category displays either a list of sub-categories or a list of snippets for the selected category. If you select a snippet, a tooltip is displayed that describes it. Double-clicking the snippet inserts it into your code. In due course, you may wish to create your own code snippets (the subject of creating code snippets is not dealt with here).