BlackWaspTM

This web site uses cookies. By using the site you accept the cookie policy.This message is for compliance with the UK ICO law.

Visual Studio
VS 2003+

Visual Studio Virtual Space

When using Visual Studio's default settings, lines of code are terminated with a carriage return and placing the caret beyond the end of a line is impossible. By enabling virtual space, the caret can be moved to any position, including unused areas.

Virtual Space

The default configuration of Visual Studio limits the areas of a code file where you can position the text cursor, or caret. When a line of code is typed and the return key pressed, a carriage return marks the end of the line. The caret cannot be positioned after the end of the line unless spaces or tabs are added to move the carriage return.

Some developers prefer to be able to position the caret anywhere within the code editor using the arrow keys or the mouse, even if no text currently exists at the selected location. This style of positioning can be enabled in Visual Studio using the virtual space option.

Virtual space allows the caret to be moved freely around the editor. If you position the caret beyond the end of a line of code and start typing, the new text is inserted at the correct location. If you later disable virtual space or give the code to a user that does not have the option enabled, you will find that spaces have been inserted automatically to maintain the layout in both modes.

Enabling Virtual Space

Virtual space is enabled using the Options dialog box, which is displayed by selecting Options from the Tools menu. Once opened, expand the Text Editor and C# sections in the tree and select the General option. Use the "Enable virtual space" checkbox to enable or disable the setting.

Visual Studio Virtual Space Setting

27 February 2010