Software Development

Customize your code editor in VB6

One of the features in the Visual Basic 6 code editor allows you to display different code elements in different colors, making it easier for you read and interpret code. Find out how you can customize this handy feature.

The Visual Basic 6 code editor has several handy features to make the programmer's task easier. One is the ability to display different code elements in different colors, making it easier for you read and interpret code. Many programmers don't know that you can customize this feature can be customized, which means you don't have to stay with the default code display scheme.

To change the settings, select Tools | Options and then click the Editor Format tab. The Code Colors list displays the various code categories that you can customize. They are as follows:

  • Normal text: Variable names (if not changed under Identifier Text), operators, literals
  • Selection Text: Text that you have selected
  • Syntax Error Text: Code in which VB finds a syntax error
  • Execution Point Text: When the program is paused during debugging, it's the next line of code to be executed.
  • Breakpoint Text: Lines of code where you have set a breakpoint
  • Comment Text: Comments in the code
  • Keywords: Visual Basic statements and data types such as Do, Dim, and Integer
  • Identifier Text: Variable names
  • Bookmark Text: Lines of code where you have defined a bookmark

Below this list are three drop-down lists that you can use to define the appearance of the selected code component:

  • Foreground: The color of the text
  • Background: The color behind the text
  • Indicator: The color of the indicator displayed in the left margin.

For each of these, you can select a color. You can also select Auto, which means that VB doesn't change the specified display attribute from the default.

On the right side of this dialog box, you can view a sample of how the selected settings will appear. You can also turn the margin indicator bar on and off and set the font and size. Note that the latter setting affects all code.

Advance your scripting skills to the next level with TechRepublic's free Visual Basic newsletter, delivered each Friday. Automatically sign up today!

0 comments