This documentation is archived and is not being maintained.

How to: Drag and Drop Text 

You can select text and then drag and drop it into various locations, such as:

  • A different location in the current document.

  • Another project document open in a different instance of the Code Editor.

  • An XML file to be stored in a code snippets folder.

  • The Toolbox.

  • The Command or Watch windows.

To drag and drop text and code

  1. Select the text you want to move, using either the mouse or the keyboard.

  2. Left-click on the highlighted text and continue holding down the mouse button.

  3. Move the mouse cursor to the destination where you want to place the text.

  4. Release the mouse button to drop the text.

Dragging text moves it; that is, the text is erased from the old location and moved to the new location. Hold down the CTRL key as you drag text to copy it to the new location.

To toggle drag-and-drop text editing, set the Drag and drop text editing option in the General, Text Editor, Options Dialog Box.

To store and retrieve text and code

  • You can drag text or code onto any Toolbox tab to store it, and then drag or double-click its Toolbox icon to paste it back into the Code Editor at the current location.

  • Visual Studio now provides segments of sample code ready to insert into Visual Basic, Visual C#, or Visual J# projects. For more information, see How to: Manage Code Snippets.

    To manage your code snippet folders, select Code Snippets Manager from the Tools menu. For more information, see Code Snippets Manager.

See Also