![]() |
Introduction to Microsoft Visual Basic |
|
The Code Editor |
|
Introduction |
|
There are two main ways you will manipulate an object of your application, visually or using code. In future sections, we will explore details of visually designing a control. Code of an application is ASCII text-based, written in plain English and readable to human eyes. For an application, you can use any text editor to write your code but one of Visual Studio's main strengths is the code editor. It is very intuitive. The Code Editor is a window specially designed for code writing. |
The Code Editor is divided in 4 sections: ![]()
The top section of the Code Editor displays tabs of property pages. Each tab represents a file. To add a new file to the project, on the main menu, you can click
Once in the Add New Item dialog box, in the Templates section, click the type of file you want to create, type a name in the Name text box, and press Enter. After the file has been created, it is represented by a tab in the top section of the Code Editor. In the same way, you can add as many files as you judge them necessary. To access a tab:
By default, the tabs display in the order their files were created or added to the project, from left to right. If you don't like that arrangement, click and drag its tab either left or right beyond the next tab
The top-left section of the Code Editor displays a combo box named Class Name. As its name indicates, this combo box holds a list of the classes ( and structures) that are created in the current file. You can display the list if you click the arrow of the combo box:
Each item of the Class Name combo box displays the name of its type associated with its parent as implemented in the code.
The top-right section of the Code Editor displays a combo box named Members. The Members combo box holds a list of the members of classes. The content of the Members combo box depends on the item that is currently selected in the Class Name combo box. This means that, before accessing the members of a particular class, you must first select that class in the Class Name combo box. Then, when you click the arrow of the Method Name combo box, the members of only that class display: ![]() If you select an item from the Method Name combo box, the Code Editor jumps to that members and positions the cursor to the left of the member.
Code is written in a wide area with a white background. This is the area you use the keyboard to insert code with common readable characters. The Code Editor uses some colors to differentiate categories of words or lines of text. The colors used are highly customizable. To change the colors, on the main menu, you can click Tools -> Options... In the Options dialog box, in the Environment section, click Fonts and Colors. To set the color of a category, in the Display Items section, click the category. In the Item Foreground combo box, select the desired color. If you want the words of the category to have a colored background, click the arrow of the Item Background combo box and select one: ![]() In both cases, the combo boxes display a fixed list of colors. If you want more colors, you can click a Custom button to display the Color dialog box that allows you to "create" a color.
|
|
|
||
| Previous | Copyright © 2008 FunctionX, Inc. | Home |
|
|
||