Adding and Deleting Named Shortcuts in the Task List

Depending on the development language you are using, you may be able to add named shortcuts to the Task List from within the application's editor.

Named shortcuts make it easier to find your code.

To add a shortcut to the Task List

  1. Right-click the line of code in the Text Editor window.

  2. Select Toggle Shortcut.

    The text on the selected line of code becomes the name of the task and is added to the Task List.

  3. If you want, you can edit the description field of the new shortcut.

    Editing the description will not change the actual line of code.

To go to the shortcut from the Task List

  • Double-click the task in the Task List.

To delete a shortcut

  1. Right-click the line of code in the editor.

  2. Choose Toggle Shortcut.

    You can also delete the shortcut directly in the Task List.


Adding and Deleting Toolbox Items

To add new Toolbox items

  1. In the Toolbox, click the tab to which you want to add the item.

  2. From the Tools menu, choose Customize Toolbox.

    Although you can drag items into your Toolbox, using the Customize Toolbox dialog box allows you to browse the registry and to locate controls and applets.

    Note You can also select text or HTML elements in the Editor and drag them to the Toolbox to create HTML Fragments.

  3. Click the tab that corresponds to the type of item you want to add.

    Items with a check mark are currently in your Toolbox but may not appear on the current tab.

  4. Select the check box to the left of the each item you want to add.

    If the item you want does not appear in the list, choose Browse to locate it.

  5. Click OK to add the item or items.

    They will appear on the appropriate tab in the Toolbox.

To delete an item from the Toolbox

  1. From the Tools menu, choose Customize Toolbox.

  2. Click the tab that lists the item you want to delete.

  3. Clear the check box to the left of the item.

  4. Click OK to delete the item.

    The item will disappear from the appropriate tab in the Toolbox.


Adding and Removing Files

A project can contain multiple files which can be opened, closed, and saved together. The types of files that can be contained within a project vary according to the language engine.

Note Solutions can also contain files which are not related to a specific project. These are listed under the Miscellaneous Files node in the Project Explorer. If you attempt to add a file to a project that isn’t appropriate for the project type, it will be added to the Miscellaneous Files node. You can also explicitly add a file to the Miscellaneous Files node using the New File or Open File commands, available from the File menu.

To add a file to a project

  1. Select the Project’s node in the Project Explorer.

  2. Choose Add Item from the Project menu.

  3. Select an existing file or a new file template from the Add Item dialog box.

    The selected item will be added to the selected project in the Project Explorer.

To remove a file from a project

  1. Select the file in the Project Explorer.

  2. Choose Remove From Project from the Project menu.

    The file will be removed from the project; it will not be deleted however, and can still be used in other projects.


Adding and Removing Projects

A solution can contain multiple projects which can be opened, closed, and saved together. For example, a solution might contain a Web project and a project for a component used on an HTML page. Each project within a solution can contain multiple files or items; the types of items contained within a project vary according to the language engine.

Information about the projects and items that make up a solution is contained in a project file. The file extension for the project file differs based on the type of project and the language engine used to create it.

To add a project to a solution

  1. Select Add Project from the File menu.

  2. Select an existing project or a new project template from the Add Project dialog box.

  3. Make sure that Add to current solution is checked and click Open.

    The selected project will appear as a new node in the Project Explorer.

To remove a project from a solution

  1. Select the project in the Project Explorer.

  2. Choose Remove Project from the File menu.

    The project will be removed from the current solution; it will not be deleted however, and can still be used in other solutions.


Adding, Deleting, and Renaming Toolbox Tabs

By default, the Toolbox contains two tabs: the General tab and the HTML tab. When you add a Toolbox item, it is displayed on the current tab. You can, however, customize your own tabs in the Toolbox so that you can organize your tools for the tasks you want to perform.

To add a new tab to the Toolbox

  1. Right-click the Toolbox.

  2. Select Add Tab.

    A blank tab is added to the Toolbox.

  3. At the blinking insertion point at the bottom of the Toolbox, type a name for the tab and press ENTER.

When you create a new tab, a pointer tool, [image], is automatically added as the first item.

To delete a tab that you've added to the Toolbox

  1. Right-click the tab in the Toolbox that you want to delete.

  2. Select Delete Tab.

To rename a tab that you've added to the Toolbox

  1. Right-click the tab in the Toolbox that you want to rename.

  2. Select Rename Tab.

  3. Type the new name for the tab.

To reorder tabs in the Toolbox

  • Drag them up or down to a new position.


Adding User-defined Tasks to the Task List

To enter a task into the Task List

  • Type your task into the Description field at the top of the Task List and press ENTER.

    Your new task will appear in the Task List based on the current filtering and sorting criteria.

To set a task's priority level

  • Click the Priority column of the task and select a priority of High, Normal, or Low.


Attaching and Detaching Processes

With component-based client/server and Internet applications, parts of your application may be running in a separate process, possibly even on a different machine. The Processes dialog box allows you to debug out-of-process components by attaching them to a debugging session.

To attach to a new process

  1. Choose Processes from the Debug menu. The Processes dialog box will appear.

  2. Select a process from the Processes list. This list will display all debuggable processes currently running on the local machine.

    If you are attached to a network, you can also view and attach to processes on another networked machine by selecting the machine name from the Machine list or by clicking the Machine button to browse the network.

  3. Click the Attach button.

To detach a process

  1. Choose Processes from the Debug menu. The Processes dialog box will appear.

  2. Select a process from the Debugged Processes list.

  3. Click the Detach button.


Checking and Deleting Task List Items

You can only check user-defined or named shortcut task list items. You can delete user-defined or named shortcut items directly; other types of task list items are deleted by the application that generated them. For example, you can delete a Comment task from the Task List by deleting it in the source code. Still other types of task list items such as Compiler tasks can be checked but not deleted.

To mark a user-defined or named shortcut task as completed

  • Click the Checked column in the Task List window.

    Checking the item as completed puts a line through the item.

To delete a user-defined or named shortcut

  • Select the entire row in the Task List and press DEL.

Caution You cannot undo deletion of a task.

To choose multiple contiguous tasks

  • Select the entire row of the first task, press SHIFT, and select the last contiguous task you want.

To choose multiple discontiguous tasks

  • Select the entire row of the first task, press Ctrl, and select the other tasks you want.


Command Line Switches

Allows you to use Visual Studio™ commands such as /make, /run, /deploy, and /rebuild from the command prompt. This is useful for unattended building of solutions.

Syntax

Vstudio {{

{SolutionName [/debug | /release] {[/deploy | /m | /rebuild]}}

-or-

{[/debug | /release] [/deploy |/m | /rebuild SolutionName}}

-or-

{{{ProjectName [/debug | /release] [/m | /rebuild]} |

{[/debug | /release] [/m | /rebuild] ProjectName}}}*

[[/run | /runexit | /out FileName]][/lcid LocaleID] [/fn FontName] [/fs FontSize] [/sdi|/mdi]}

-or-

{/?}

* You can repeat either of these commands multiple times in the command line. Doing so allows you to build projects using different Microsoft® Visual Studio applications. For example, you can build a Java and a Visual InterDev™ project at the same time by repeating one of these lines and using the appropriate ProjectName.

The parts of the command line syntax are:

Argument | Description
ProjectName or SolutionName | Designates the project (for example, .vjp, or .vip), or the solution file (that is, .sln).
/debug | Tells Visual Studio to build ProjectName or SolutionName in debug mode.
/release | Tells Visual Studio to build ProjectName or SolutionName in the form that you want to distribute it.
/deploy | Deploys the solution using the active deployment map.
/make or /m | Tells Visual Studio to build ProjectName or SolutionName using the current build settings.
/run or /r | Tells Visual Studio to build and run ProjectName or SolutionName using the current build settings. The development environment is displayed and active when the project or solution is finished running.
/runexit | Tells your product to run ProjectName or SolutionName. The development environment is minimized when the project or solution is run. If for any reason the file is changed in the process of running, all changes are ignored and no dialog box appears on exit to design mode. This argument uses the current build settings.
/rebuild | Removes the built project files and then rebuilds the project or solution.
/out | Allows you to specify a file to receive errors. Must be used with /m, /deploy, or /rebuild. The errors are placed in this file, along with other status information. If you do not use this option, command line build errors will be displayed in a message box.
FileName | Designates the file to receive errors when you build an executable using the /m, /runexit, /deploy, or /rebuild option.
/lcid or /l | Sets the environment's default language.
LocaleID | Designates the LCID you want to use.
/fn | Changes the system font for the environment.
FontName | Designates the font you want to use. For example, /fn timesnewroman changes the system font to the Times New Roman font.
/fs | Changes the size of the system font for the environment.
FontSize | Designates the size of the font you want to use. For example, /fs 12 changes the font to 12 point.
/sdi | Changes the Visual Studio environment to SDI (single document interface) mode. When in SDI mode, every window you have open appears on the desktop. Visual Studio remains in SDI mode until you change it. You can change to MDI mode by using the /mdi argument or by clearing the SDI Environment option on the General Environment page in the Options dialog box.
/mdi | Opens your product in MDI (multiple document interface) mode. When in MDI mode, you have on you desktop one window that contains the other windows you have open. Your product remains in MDI mode until you change it. You can change to SDI mode by using the /sdi argument or by selecting the SDI Environment option on the General Environment page in the Options dialog box. MDI mode is the default.
/? | Lists the available command line arguments.

You can use these arguments by choosing Run from the Start menu or from the command line. For example, you can use the following command to run Visual Studio and then load and run MySol.sln:

C:\Vstudio MySol.sln /r


Continuing After an Error

Although you can enter a correction and continue program execution with the same line that halted the application, any changes will be ignored until you terminate the debug session, rebuild, and restart the application.

To continue execution from break mode

  • From the Debug menu, choose Continue.

Some changes (most commonly, changing variable declarations or adding new variables or procedures) require you to restart the application. When this happens, a message is presented that asks if you want to restart the application.


Controlling Threads

In a multithreaded application, the Threads window allows you to switch between threads of execution for debugging purposes. Only one thread of execution may be debugged at a time.

You can switch threads by selecting them in the Threads list. The contents of the other debugging windows change to reflect the selected thread.

To view the Threads window

  • Choose Threads from the Debug Windows submenu, available from the View menu.


Creating Custom Templates

Any text file, such as .htm, .asp, or .java files, can be used as a template for creating new similar project items. When creating a file, you can base it on a standard product template or use one of your own custom templates. Creating a template consists of some or all of these steps:

  • Customizing template files

  • Creating a .vsz file

  • Creating a .vsdir file

  • Adding templates to projects

Customizing Template Files

You can place text in a template file, such as source code, URLs, and script, that will be copied into the new project item you create from the template file.

You can place source code, URLs, text, script, and other formatting in the template files that will appear in each file you create based on the template file.

A template can be any text file such as an:

  • .htm file

  • .asp file

  • code file

  • .txt file

  • .java file

  • other text file

Note The Template wizard recognizes text files based on the content type registered for the file extension. If the wizard does not recognize a particular file, you need to register the file extension as a text file in the system registry. For more information, see "To create or modify a file type" in Windows Help.

The Template wizard allows you to prompt users for information based on the parameters you include in your template files. You can create your own custom prompts or you can use one of the unique functions recognized by the Template wizard.

To prompt the user for input

  • Use delimiters <%# and #%> in the template to create a parameter. Parameters are not case sensitive.

    For example, to prompt your user with a question, place text between the delimiters, as follows:

    <B><%#What is the name of your department?#%> Expense Report</B>

    If the user responds with the input "Marketing" then the new file would contain this line:

    <B>Marketing Expense Report</B>
  • <%#DataConnection#%>

    Available for Visual InterDev™ templates only. When the Template wizard encounters this parameter, it prompts the template user to select one of the existing project data connections.

  • <%#GUIDn#%>

    n=1-9. When the Template wizard encounters this parameter, it generates a Globally Unique Identifier (GUID) string and replaces the parameter with the string. A GUID is a 128-bit (16 byte) number generated by an algorithm designed to ensure uniqueness. Use the GUID parameter to uniquely identify items, such as interfaces, objects, and correctable class Ids, in code each time you create a new file based on a template which contains these items.

    Each additional time the Template wizard encounters the same GUID parameter, it substitutes the same GUID string. For example, each time the Template wizard finds GUID1, the wizard replaces GUID1 with the correct GUID string. Similarly, each time that the Template wizard encounters GUID2, it replaces GUID2 with the GUID string the wizard generated when it first encountered GUID2.

Note When you add an .htm or .asp file to a Visual InterDev Web project, Visual InterDev automatically applies the default theme and layout for the project to the page if one has been specified.

Creating a .vsz File

In order to add your files to a project using the Template wizard, you must create a .vsz file. A VSZ file is a text file used to launch wizards. The VSZ file contains information that identifies a wizard and provides custom information for it. For more information about .vsz files, see Creating VSZ Files.

Note If you create single template files that do not contain any user prompts, you can place the file in the default project items directory for the product. Single template files that do not contain user prompts do not require .vsz or .vsdir files.

To launch the Template wizard, the .vsz file must contain the following text:

VSWizard 6.0
Wizard=VIWizard.CTemplateWizard
Param=<directory path for template files>

For example, if you created a template that contains two files, MyTemplate.htm and MyTemplate.asp, and placed them in c:\Program Files\Microsoft Visual Studio\Vintdev98\Templates\MyTemplate directory, the .vsz file would read:

VSWizard 6.0
Wizard=VIWizard.CTemplateWizard
Param=c:\Program Files\Microsoft Visual Studio\Vintdev98\Templates\MyTemplate

If you created a template that contains two files, MyTemplate1.java and MyTemplate2.java, and placed them in c:\Program Files\Microsoft Visual Studio\VJ98\Templates\MyTemplate directory, the .vsz file would read:

VSWizard 6.0
Wizard=VIWizard.CTemplateWizard
Param=c:\Program Files\Microsoft Visual Studio\VJ98\Templates\MyTemplate

You can optionally indicate which template file should open automatically in the editor when the Template wizard has finished. For example, you can specify that MyTemplate1.java open in the editor by adding a second Param statement to the end of the .vsz file:

Param=MyTemplate1.java

For more information, see "Adding Templates to Projects" later in this topic.

Creating a .vsdir File

You can optionally create a VSDIR file or modify an existing .vsdir file to specify the display of .vsz files in the Add Items dialog box. A VSDIR file is a text file that is used to provide information to the Add Item dialog and the New Project dialog boxes. The VSDIR provides information about the items these dialog boxes display, such as the names, descriptions, and the icon to display.

You can have multiple VSDIR files in a single directory; however, generally one VSDIR file is used to contain information for multiple wizards, folders, or templates.

Note If you have multiple .vsdir files in a single directory, do not duplicate the same file information in multiple .vsdir files.

For example, you could create a .vsdir file like the following:

MyTemplate.vsz|{0}|MyTemplate|30|Create a new custom file.|{164B10B9-B200-11D0-8C61-00A0C91E29D5}|287|3|MyTemplate

Note The .vsdir file contains line-oriented records.

For more information about .vsdir files, see Creating VSDIR Files.

Adding Templates to Projects

You must place your .vsz and .vsdir files in the correct directories so that the Add Items dialog box can locate the files.

Note If you create single template files that do not contain any user prompts, you can place the file in the default project items directory for the product. Single template files that do not contain user prompts do not require .vsz or .vsdir files.

For Visual InterDev, the default project items directory is:

c:\Program Files\Microsoft Visual Studio\VintDev98\Templates\Web Project Items\

For Visual J++™, place .vsz files and single template files in:

c:\Program Files\Microsoft Visual Studio\VJ98\VJProjectItems\Other

You can also create a custom directory under c:\…\VJProjectItems.

Each template should have a separate directory to contain only its template files. If the files for a template are not located in the same directory, the Template wizard can not process them.


Creating Custom Workspaces

You can create custom workspaces called window layouts.

To save a window layout

  1. Arrange the windows in your workspace.

  2. Select Define Window Layout from the View menu.

  3. In the Define Window Layout dialog box, type the name of the new window layout.

    The window layout is saved when you change views so you can return to it.

To open a saved window layout

  • Choose the Define Window Layout command on the View menu.

To apply a view

  1. Select Define Window Layout from the View menu.

  2. In the Define Window Layout dialog box, select the view you want to apply from the Views list.

  3. Click the Apply button.

Your window layout also gets saved each time you switch among design, debug, and Full Screen modes. For example, you set up your design workspace, save the window layout, and then change to debug mode. While in debug mode, you display the Task List and then switch back to your defined window layout. When you return to debug mode, the Task List is still displayed because the development environment saved your window layout. The default design and default debug window layouts are always available in the Define Window Layout dialog box or the Load/Save Window UI box on the Window UI toolbar.


Creating Solutions

A solution is a group of one or more projects and associated items. Each time you work in the Integrated Development Environment you are working with a solution; each instance of the IDE can contain only one solution. The current solution is represented by the top-level node in the Project Explorer window.

Information about the projects and items that make up a solution is contained in a solution (.sln) file.

To open a new solution

  1. Select New Project from the File menu.

  2. Choose a new or existing project from the New Project dialog box as the base project for the solution and select Close Current Solution.

  3. Click the Open button.

To save the current solution

  1. Select the solution node in the Project Explorer.

  2. Select Save from the File menu.

Note The specific types of projects, files, or items that a solution can contain may vary depending on the language engine. See language specific documentation for more information.


Debugging Basics

The process of locating and fixing errors in your application is known as debugging. The development environment’s debugging support includes breakpoints, break expressions, watch expressions, and the ability to step through code one statement or one procedure at a time and display the values of variables and properties. Many of the languages supported in the development environment also include special debugging features, such as edit-and-continue capability, setting the next statement to execute, and procedure testing while the application is in break mode.

Debugging tools are designed to help you with:

  • Compile errors that result from incorrectly constructed code. If you incorrectly type a keyword, omit some necessary punctuation, or use an opening identifier without a corresponding closing identifier at design time, these errors are detected when you compile the application.

  • Run-time errors that occur while the application is running and the environment detects an operation that is impossible to carry out. An example of this is division by zero.

  • Logic errors that occur when an application doesn't perform the way it was intended to. An application can have syntactically valid code, run without performing any invalid operations, and yet produce incorrect results. Only by testing the application and analyzing results can you verify that the application is performing correctly.

Debugging tools give you a snapshot of the current state of your application, including:

  • Appearance of the user interface.

  • Values of variables and expressions.

  • Active procedure calls.

There are four main windows that you'll use while debugging your application:

  • The Immediate window allows you to change the values of variables so that you can immediately see the effect of your changes. When the application is in break mode, you can evaluate expressions by typing in the Immediate window.

  • The Watch window shows the current watch expressions, which are expressions whose values you decide to monitor as the code runs. The Watch window can display a value for a watch expression only if the current statement is in the specified context. Otherwise, the Value column shows a message indicating the statement is not in context.

  • The Locals window shows the value of any variables within the scope of the current procedure. As the execution switches from procedure to procedure, the contents of the Locals window changes to reflect only the variables applicable to the current procedure.

  • The Output window displays status messages at run time. With some language engines, this window is also used to display debugging strings generated in code.

There are also several other debugging windows that you will use in certain situations, depending upon the type of application you are debugging and upon the language engine.

  • For multithreaded applications, the Threads window allows you to change the current thread of execution or view the threads in any attached process. The contents of the other debugging windows change to reflect the selected thread.

  • The Call Stack window displays a list of all active procedures or stack frames for the current thread of execution. Active procedures are the uncompleted procedures in a process. For Internet applications, the Running Documents window displays a list of documents that are currently loaded into the process you are debugging. For example, if you load an HTML frameset into the browser, the Running Documents window shows you which pages are currently loaded.


Ending a Debugging Session

A debugging session ends when all of the processes you are debugging terminate. You can also end a debugging session in one of the following ways:

To end a debugging session

  • From the Debug menu, choose Continue to enter run mode and continue executing the application from the current line of code.

    -or-

  • From the Debug menu, choose Restart to terminate the processes in your debugging session and restart the application from the beginning.

    -or-

  • From the Debug menu, choose End to shut down the application and return to design mode.


Entering Break Mode at a Problem Statement

Break mode halts the operation of an application and gives you a snapshot of its condition. Variable settings are preserved, so you can analyze the current state of the application and enter changes that affect how the application runs. When an application is in break mode, you can:

  • Modify code in the application.

  • Observe the condition of the application's interface.

  • Determine which active procedures have been called.

  • Watch the values of variables, and expressions.

  • Change the values of variables.

  • View or control which statement the application will run next.

  • Run statements immediately.

  • Manually control the operation of the application.

To enter break mode at run time

  • Choose Break from the Debug menu.

    It's possible to break execution when the application is idle (when it is between processing of events). When this happens, execution stops when the next line of code is run.

    -or-

  • Set a breakpoint in your code in the Text Editor window or define a breakpoint in the Breakpoint dialog box.

    When the program encounters a breakpoint at run time, it will enter break mode before executing the line of code where the breakpoint was set.

    -or-

  • Programmatically place a statement in your code. The command for entering break mode varies by language. For more information about a specific language, see the debugging topics for that language.

To enter break mode at design time

  • Select Step Into from the Debug menu.

    Break mode will be entered at the first line of code in your application.

    -or-

  • Select Run to Cursor from the Debug menu.

    The application will enter break mode when it reaches the current line of code in the Text Editor window.

    The exact behavior of break mode may differ slightly for different language engines or certain types of applications. For more information, see the debugging topics for your programming language.


Executing Commands and Evaluating Expressions in the Immediate Window

To view and change values, you use the Immediate window. You can evaluate any expression, variable, or object in the window and see the value that is returned, or you can see the effects of commands you enter (which must be in the language of the code currently executing).

Rules for inspecting values and entering commands may vary slightly for different languages. For more information about a specific language, see the debugging topics for that language.

Once you're in break mode, you can move the focus to the Immediate window to examine data. You can evaluate any valid expression in the Immediate window, including expressions involving properties or variables. The currently active function on the call stack determines the scope.

You can also enter commands in the Immediate window to execute procedures or change the value of variables or properties; these commands will be executed immediately. The syntax and rules for executing commands are dependent on the language engine.

To execute a statement again

  • Move the insertion point back to that statement. You can edit the current statement to alter its effects, and then choose Set Next Statement from the Debug menu.

To move around in the Immediate window

  • Use the mouse or the arrow keys. See "Immediate Window Keyboard Shortcuts" for how to navigate the Immediate window with the keyboard.

    Don't press ENTER unless you are at a statement you want to execute.


Filtering in the Object Browser

Use the filter dropdown to type in a string that constrains the current view. The filter is always applied to the left pane. For example, if you type in "font" in the filter dropdown while classes are displayed, the left pane then only shows classes that contain the word "font." To look for members containing "font", click the Show Members button for the left pane.

By default, the filter is an in-string match.

To apply a new filter

  1. Enter a filter string in the Filter dropdown box.

  2. Press ENTER to initiate the filter.

The filter is applied to the content views in the left pane until removed.

To switch to a beginning of word match

  1. Enter a filter string in the Filter dropdown box.

  2. Click the Filter finds Beginning of Word Only button on the command bar.

  3. Press ENTER to initiate the filter.

The filter is applied to the content views in the left pane until removed.

To remove the applied filter

  • Click the Remove Filter button.

This removes any text in the Filter dropdown, and updates the contents of the left and right panes appropriately.

All command bar buttons that affect the viewed content affect the left pane only. The "Show Classes", "Show Members" and "View by Package (Library)" directly affect what is being viewed in the left pane. Filtering is applied only on the left pane. Grouping and Sorting is applied to the left pane when the grouped and sorted items are visible in the pane.

The pane’s caption reflects its content. Here are two examples:

  • Classes and Members w"AnyString" (Classes, Members pressed, Filtering In String Match for "AnyString")

  • Packages Only (Classes, Members depressed, "View by Package (Library)" button pressed)


Icons Used in the Development Environment

The development environment contains many icons that represent various items, depending upon the application you are using. The following is a list of the most common icons and what they represent.

Note Some applications may have additional icons that do not appear in this list.

This icon | Represents a(n)
 | .asp file
 | Any image file
 | Any image map
 | Audio file
 | Cabinet
 | CDF
 | Circular reference
 | Class
 | Class File
 | Compressed class
 | Constant
 | Delegates
 | Enum
 | Error
 | Event
 | Executable file
 | Field variable
 | Folder/Subfolder
 | Global.asa file
 | HTML file
 | Import folder
 | Imported class
 | Imported package
 | Inherited field
 | Inherited members folder
 | Inherited method
 | Inherited variable
 | Initializer
 | Initializer folder
 | Inner class folder
 | Interface
 | Interface folder
 | Intrinsic alias
 | Java source file
 | Library
 | Member class
 | Method
 | Method overload
 | Microsoft Visual J++™ Project
 | Module
 | Other text file
 | Package
 | Private access
 | Project
 | Property
 | Protected access
 | Resource bundle
 | Resource file
 | Site diagram
 | Stylesheet
 | SuperClass
 | Superclass folder
 | Type library
 | Valid window shortcut
 | Video file
 | X-World file


Inspecting Variables and Properties with the Watch Window

Watch expressions allow you to monitor the values of variables, properties, and expressions at run time. Many debugging problems aren't immediately traceable to a single statement, so you may need to use a watch expression to observe the behavior of a variable or expression throughout a procedure.

The development environment automatically monitors the watch expressions you define. When the application enters break mode, these watch expressions appear in the Watch window, where you can observe their values.

To add a watch expression at design time or in break mode

  • Drag an expression or variable from a Text Editor window to the Watch window.

    -or-

  • Type a valid expression in the Watch window.


IntelliMouse Support

With the Microsoft® IntelliMouse™, you can take advantage of additional navigational features in the development environment. The IntelliMouse is a pointing device with a wheel control between the two buttons. The wheel control is both a wheel and a button that makes common navigation functions easy to perform with the mouse.

You can:

  • Rotate the wheel to scroll through a window more quickly than using the scroll bars.

  • Press the wheel and move the mouse to smoothly scroll vertically. This is called panning.

  • Click the wheel button to place it in autoscroll mode and navigate without pressing the mouse button.

You can use the IntelliMouse wheel in these areas:

  • Text Editor window

  • Immediate window

  • Locals window

  • Object Browser

  • Project Explorer

  • Properties window

  • Watch window

  • Web documents


Keyboard Remapping

The keyboard mapping scheme defines the keystroke combinations that can be used while working in the integrated development environment. You can choose from several predefined schemes or define your own.

Predefined keyboard mapping schemes include schemes that match Microsoft® Developer Studio® 5 and 6, Microsoft Visual Basic® 5 and 6, and Microsoft Visual C++® 2.

To choose a predefined keyboard mapping scheme

  1. Select Options from the Tools menu.

  2. In the Options dialog, select the General, Keyboard node.

  3. Choose a scheme from the Keyboard Mapping Scheme dropdown.

To define a new keyboard mapping scheme

  1. Select Options from the Tools menu.

  2. In the Options dialog, select the General, Keyboard node.

  3. Modify the keyboard mapping scheme as desired, then enter a name for the new scheme in the Keyboard Mapping Scheme dropdown listbox.

  4. Click the Save button.


Linking Windows

The development environment allows you to drag tool windows onto each other to create linked windows. Tool windows are windows defined by each development language (for example, the Toolbox). There are two types of tool windows:

  • Linked windows appear as one window with the title bar separating each window from the other.

  • Tabbed linked windows appear as one window with a set of tabs that take you to the other linked windows.

You can create and separate linked or tabbed linked windows and can reorder the tabs of tabbed linked windows.

To create a linked window

  • Click the title bar of the tool window you want to link, and then drag it to one side of the window to which you want to link.

    Windows can be linked horizontally or vertically or to the right or left side of the destination window.

To separate linked windows

  • Click the title bar and drag the window out of the linked window

    -or-

  • Double-click the title bar.

To create tabbed linked windows

  • Click the title bar of the window you want to link, and then drag it to the title bar of the window with which you want to create a tabbed link.

    A tab outline appears when you drag the window over the appropriate place.

To separate tabbed windows

  • Click the tab of the window you want to separate, and then drag it out of the tabbed linked set

To reorder tabs

  • Drag the tab you want to move to the new location.

    The active tab locks to the desired location, and the other tabs move to the right or left of it.


Margin Indicators

The Text Editor window contains margin indicators that provide visual cues to certain actions during the editing of your code.

The margin indicators appear in the Margin Indicator bar on left side of the Text Editor window. You can turn the Margin Indicator bar on and off in the General page of the Text Editor options in the Options dialog box.

Margin Indicator | Named | Indicates
 | Enabled Breakpoint | A breakpoint that you set using the Toggle Breakpoint command on the Debug menu. You can toggle the breakpoint by placing your mouse pointer in the Margin Indicator bar and clicking.

Current Line of Execution | The line of code that will be executed next. You can drag this margin indicator to a new location within any running code module to mark the line of code to be executed next. If you drag the Current Line of Execution margin indicator to any nonvalid region or line, nothing happens and the indicator returns to the original location.
Bookmark | The location of a bookmark set using the Toggle Bookmark command on the Edit menu.
Call Stack Marker | Lines that are currently in the call stack and the current line of code that is about to be executed. The Call Stack Marker indicator appears only in break mode.
Disabled Breakpoints | The location of a breakpoint that has been disabled and will be ignored when the code is run.
Breakpoint in Error | An invalid breakpoint exists. This breakpoint will be ignored when code is run.
Shortcut | A named shortcut that you created using the Toggle Shortcut command on the shortcut menu. It appears in the Task List. This is the equivalent of Named Bookmarks.


Using Breakpoints to Pause Application Execution

Pausing Application Execution with Breakpoints

To control the execution of your application, you set breakpoints, which are places where the code should pause and call the debugger. You can set or remove a breakpoint at design time or at run time.

To set or remove a breakpoint

  • In the Text Editor window, move the insertion point to the line of code where you want to set or remove a breakpoint and click in the selection margin.

    -or-

  • From the Debug menu, choose Toggle Breakpoint.

    -or-

  • From the Debug menu, choose Show Breakpoints to display the Breakpoints dialog box.

When you set a breakpoint, a red dot is displayed in the selection margin of the Text Editor window next to the line containing the breakpoint.

After setting breakpoints, you can run the application in the development environment. When execution reaches the first breakpoint, the code pauses and starts the debugger. The next line to be executed is indicated in the Text Editor window by a yellow arrow in the selection margin.

After reaching a breakpoint, you can execute, or step into, individual lines in your code. As you step through lines, the code executes and you can see the effect of each line.


Regular Expressions

Regular Expressions are a concise and flexible notation for finding and replacing patterns of text. The following table shows the Regular Expressions that can be inserted into the Find or Replace boxes. You can type the following regular expressions. Use regular expressions to refine and expand your search.

Note You must press the Use Regular Expressions button before using any of the following as part of your search criteria.

Expression | Syntax | Description
Beginning of Line | ^ | Starts the match at the beginning of a line. Significant only at the start of an expression.
Or | | | Matches the expression before or after the |. Mostly used within a group. For example, "(sponge)|(mud) bath" matches "sponge bath" and "mud bath."
End of Line | $ | Anchors the match to the end of a line. Significant only at the end of an expression.
Character Not in Set | [^] | Matches any character not in the set of characters following the ^.
Tagged Expression | {} | Tags the text matched by the enclosed expression, You can match another occurrence of the tagged text in a Find expression or insert the tagged text in a Replace express using \N.
Grouping | () | Groups a subexpression.
Nth Tagged Text | \N | In a Find expression, matches the text matched by the Nth tagged expression, where N is a number from 1 to 9. In a Replace expression, inserts the text matched by the Nth tagged expression where N is a number from 1 to 9. \0 inserts the text matched by the entire Find expression.
Any Character | . | Matches any one character.
One or More | + | Matches at least one occurrence of the preceding expression.
Maximum of One or More | # | Matches at least one occurrence of the preceding expression, matching as many characters as possible.
Escape | \ | Matches the character following the backslash (\). This allows you to find characters used in the regular expression notation, such as { and ^.
Prevent Match | ~X | Prevents a match when X appears at this point in the expression. For example, "rea~(ity)" matches the "real" in "realty" and "really," but not the "real" in "reality."
Repeat N Times | ^N | Matches N occurrences of the preceding expression. For example, "[0-9]^4" matches any 4-digit sequence.
Set of Characters | [] | Matches any one of the characters within the []. To specify a range of characters, list the starting and ending character separated by a dash (-), as in [a-z].
Alphanumeric Character | :a | Matches the expression ([a-zA-Z0-9]).
Alphabetic Character | :c | Matches the expression ([a-zA-Z]).
Decimal Digit | :d | Matches the expression ([09]).
Hexadecimal Digit | :h | Matches the expression ([0-9a-fA-F]+).
Identifier | :I | Matches the expression ([a-zA-Z-$][a-zA-Z0-9_$]*-).
Relational Number | :n | Matches the expression (([0-9]+.[0-9]*)|([0-9]*.[0-9]+)|([0-9]+)).
Quoted String | :q | Matches the expression (("[~"]*")|('[~']*')).
Alphabetic String | :w | Matches the expression ([a-zA-Z]+).
Decimal Integer | :z | Matches the expression ([0-9]+).
Tab Character | \t | Matches a tab character, Unicode U+0009.
Unicode Character | \x#### or \u#### | Matches a character given by Unicode value where #### is 1 to 4 hexadecimal digits.
Zero or More | * | Matches zero or more occurrences of the preceding expression.
Maximal Zero or More | @ | Matches zero or more occurrences of the preceding expression, matching as many characters as possible.


Reusing the Current Document Windows

Reusing the current document window is a good way to minimize the number of windows open in your workspace. For example, if you are debugging a project and do not have the reuse option selected, you could have many windows open at one time. With the reuse window of current document option selected, you could have just one document window open.

If you chose the Reuse window of current document, if saved from the General options of the Environment category of the Options dialog box, the current document window functions as a browser where the contents a document window appears when you open it. Using the current document window as a browser does not affect the content of your document window. Each time a document window is opened, the document in current document window is closed. If you edit the contents of document while using the reusing current document window and do not save it, you will not lose your changes. Instead, when you open a new document window it appears in another document window and now you have two document windows in your workspace. You still have an opportunity to save the changes and close the previous document window.


Setting a StartUp Project

When a solution contains multiple projects, one project must be designated as the StartUp project. Code in the StartUp project will be executed first when the solution is run. By default, the first project added to a solution is the StartUp project.

To set the StartUp project

  1. Select the project in the Project Explorer.

  2. Choose Set as StartUp Project from the Project menu.


Setting Options for the Editor

You can change many of the default settings for the Text Editor to conform to your preferences. Some settings are available on a per-language basis, allowing you to configure the Text Editor differently for each development language that you use. Other settings are global and apply to all instances of the Text Editor regardless of the language engine. Options can be set or changed in the Options dialog box.

To open the Options dialog box

  • Choose Options from the Tools menu.

Options for the Text Editor are listed in the treeview pane of the Options dialog box, under the Text Editor node. As you select a node in the treeview pane, the corresponding options are shown in the right-hand pane of the Options dialog box.

To set global options

  • Select a first-level node beneath the Text Editor node. If any second-level nodes appear beneath the node you have selected, options set on the first-level node override any corresponding per-language settings on the second-level node.

To set per-language options

  • Select a second-level node beneath the Text Editor node. Any settings made at this level supercede corresponding first-level settings for the selected language only.

    Note If you subsequently change an option setting on a first-level node, your corresponding per-language settings (where applicable) will be overridden.


Sorting and Showing Task List Items

Items in the Task List can be sorted or arranged to create custom views and help you focus on specific tasks. You can:

  • Sort by Priority, Category, Checked, Description, File, or Line.

  • Display a subset of tasks by filtering by Category, Current File, or Checked status.

Each time you arrange or sort the Task List, the current state is saved.

To return to the previous state

  • Select Previous View from the shortcut menu.

    You can only go back one previous view.

To sort tasks

  • Click the task heading.

    Items are sorted in ascending order. As new task items are added to the Task List, they are arranged according to the current sorting scheme.

To view your tasks by a particular category

  1. Right-click the Task List window.

  2. Choose Show Tasks and then select a category, such as User.

    The category types vary with the development environment you are using to build a project.

  3. Select the category you want to view.

    The Task List displays only those tasks for the category you selected.

To view all of your tasks

  1. Right-click the Task List window.

  2. Choose Show Tasks.

  3. Choose All.


Stepping Through Code to Trace Execution

If you reach a point in your code that calls another procedure (a function, subroutine, or the script associated with an object or applet), you can enter (step into) the procedure or run (step over) it and stop at the next line. At any point, you can jump to the end (step out) of the current procedure and carry on with the rest of the application.

You may want to step through your code and trace code execution because it may not always be obvious which statement is executed first. Use these techniques to trace the execution of code:

  • Step Into: Traces through each line of code and steps into procedures. This allows you to view the effect of each statement on variables.

  • Step Over: Executes each procedure as if it were a single statement. Use this instead of Step Into to step across procedure calls rather than into the called procedure.

  • Step Out: Executes all remaining code in a procedure as if it were a single statement, and exits to the next statement in the procedure that caused the procedure to be called initially.

  • Run To Cursor: Allows you to select a statement in your code where you want execution to stop. This allows you to "step over" sections of code (for example, large loops).

To trace execution from the current statement

  • From the Debug menu, choose Step Into, Step Over, Step Out, or Run To Cursor.

To trace execution from the beginning of the program

  • From the Debug menu, choose Step Into, Step Over, Step Out, or Run To Cursor.


Tips for Debugging

To simplify debugging

  • When your application doesn't produce correct results, browse through the code and try to find statements that may have caused the problem. Set breakpoints at these statements and restart the application.

  • When the program halts, test the values of important variables and properties. Use the Immediate window to examine variables and expressions.

To track down a difficult bug

  • First and foremost, make a backup. This is the point at which even experienced programmers frequently lose many hours of work. When you experiment, it is far too easy to accidentally overwrite or delete necessary sections of code.

  • Use the debugging facilities built into the integrated development environment. Attempt to identify the line or lines of code generating the error. Isolate the code. If you can isolate the problem to one block of code, try to reproduce the same problem with this block of code separated from the rest of your program. Select the code, copy it, start a new project, paste the code into the new project, run the new project, and see if the error still occurs.

  • Simplify the problem. If possible, remove any third-party components from your project. Eliminate any code that does not seem to relate to the problem.

  • If you cannot locate a solution and are unable to isolate or resolve the problem with any of these methods, it's time to look for help. See "Technical Support" in the documentation.


Using the Text Editor

You use the Text Editor window to write, display, and edit code, script, and HTML or text documents. You can open multiple Text Editor windows, so you can easily view the code in different modules, and copy and paste between them. All open Text Editor windows are listed in the Window list, available from the Windows menu.

To open a Text Editor window

  • Select a code module or document in the Project Explorer window, and choose the View Code toolbar button.

    -or-

  • Select a code module or document in the Project Explorer window, and choose Code from the View menu.

Text Editor Features

The Text Editor has several features to simplify the process of writing and editing code. The features that are available to you may vary depending on the language engine and the Text Editor option settings.

Drag and Drop

You can drag a selected text or block of code in order to move, copy, or delete it. You can also drag certain code elements such as variables or statements in order to debug them.

To move text

  • Select the desired text and drag it to a new location in the current Text Editor window, or to another Text Editor window.

To copy text

  • Select the desired text and, while holding the CTRL key, drag it to a new location in the current Text Editor window, or to another Text Editor window.

To delete text

  • Select the desired text and drag it to the Recycle Bin.

To debug a variable or statement

  • Select a variable or statement and drag it to the Watch window or the Immediate window.

Statement Builder

The Statement Builder provides you with assistance while writing your code. The Statement Builder options available may vary depending on the language engine you are using or on the settings of the Text Editor options. Check the documentation for your specific language.

Member List

The Member list is a drop-down listbox that contains the properties and methods available for a selected object. As you type an object name using the object.member syntax, the list will appear after you type the period.

To select a member, type the first letter or letters of the member name until the desired member is highlighted. You can also navigate through the list using the Up, Down, PageUp, PageDown, Ctrl+PageUp, or Ctrl+PgDown keys.

Once the desired member is selected, pressing any delimiter key will commit the current item and insert it in your code. The delimiter keystroke is also inserted following the member, as shown:

Delimiter Key | Result
Tab | Commits the selected member. The insertion point is located immediately behind member.
Space | Commits the selected member followed by a space.
Enter | Commits the selected member and places the insertion point at the beginning of a new line.
Comma | Commits the selected member followed by a comma.

If no member is highlighted, Tab or Ctrl+Enter commit the current item in the list.

Complete word

Fills in the rest of the word you are typing once you have entered enough characters for the editor to identify the word you want.

Parameter Information

Provides information about the parameters of the initial function or statement. If you have a function or statement that contains function calls as its parameters, choosing Parameter Info provides information about the first function. Quick Info provides information about each embedded function.

While the Parameter Info window is visible, typing a comma (,) causes the next parameter to be displayed in bold.

The Parameter Info, once activated, will not close until:

  • all of the required parameters are entered.

  • the function is ended without using all of the optional parameters.

  • you press ESC.

List constants

Displays a dropdown list of constants for a property or parameter. After you type the name of a property or a parameter, the list drops down showing any available constants.


Using the Object Browser

The Object Browser allows you to flexibly browse, filter, and search for components that you may want to consume in your projects.

To invoke the Object Browser

  1. On the View menu, click Other Windows.

  2. Click Object Browser.

You can view any libraries or packages that can be referenced from the current project. Depending on the type of project and the language engine being used, this might include:

  • the current project’s source code

  • all Java Class Path packages and classes

  • type libraries for any referenced COM objects.

The left pane shows a list of all the packages or libraries. Each can be expanded to show the classes contained in the package. Members associated with those classes appear in the right pane.

Member type, access grouping, filtering, and display can be set to customize the view.

  • Switching Views - You can change the content and display of the left pane: showing classes and/or members, and whether they’d be grouped into packages or listed alphabetically. Expanding classes exposes their inheritance structure, grouped into Superclasses, Subclasses and Interfaces categories that, in turn, expand to show the inheritance tree of the respective type.

  • Changing Browsed Set - Click on the "Packages (Libraries)" button from the command bar to display the Libraries dialog box. The Libraries dialog contains a checked tree view pane that allows the user to select both the project and Java and COM components that are on the user's machine. The user checks the libraries he or she wants to browse and clicks OK. This becomes the active Library when you switch back to the main Object Browser dialog box. By default, only libraries that can be referenced from the current project or projects are browsed.

  • Searching - The Filter dropdown allows the user to type in strings that he or she wants to filter on in the left pane. For example, if the user typed "MyEvent" and pressed ENTER with the classes displayed, any classes containing the characters "MyEvent" would be displayed in the left pane. If the user then switched to view members, only member names containing the characters "MyEvent" would be displayed. To clear the filter, click on the Remove Filter button

  • Grouping and Sorting - Click on the Grouping and Sorting button to group or sort members and classes by type and access. For example, within the Grouping dialog, choosing Group by Access in the Members dropdown displays a list of access types such as Public, Private, and Protected. You can then set the sort order for these items. Additionally, you can check whether the grouped items are placed into a tree structure.

  • Persistence - The object browser persists any referenced libraries that are not part of the current projects. For instance, the user could add a library reference to a COM library that would always be available to be browsed no matter what projects were loaded. This extra library info is stored in the registry. The browsed set is persisted per solution. Should any of the packages in a browsed set no longer be registered on the machine, they are taken off the browsed set and are no longer persisted with it.


Viewing a List of Running Documents

The Running Documents window displays a list of HTML documents that are active in any attached process capable of displaying HTML, such as Internet Explorer. This window allows you to debug scripts or components embedded in HTML pages using the script debugger.

You can attach to any script or applet currently running, which can include scripts and components in pages that are not part of your current project. You can debug scripts running locally on your computer or attach to processes running on remote computers, such as an .asp page running on a server.

If you aren't attached to any processes, the Running Documents window will be empty.

To view the Running Documents window

  • Choose Running Documents from the Debug Windows submenu, available from the View menu.


Viewing Local Variables in the Locals Window

The Locals window displays the values and types of all variables that are within the scope of the currently executing procedure. This window allows you to learn about the lifetime of a variable as you step through your application because you can see when it is initialized, when it changes, and when it is destroyed. When a variable comes into scope it will be shown in the window. It remains visible as long as it is in scope, reflecting any changes to its value. When the variable goes out of scope it is removed from the Locals window.

With languages that support multiple threads of execution, you can view the local variables for a particular thread by selecting it from the threads list.

To view the Locals window

  • Choose Locals from the Debug Windows submenu, available from the View menu.


Viewing Messages or Results in the Output Window

The Output window displays messages generated by the compiler. It also displays the output resulting from debugging instructions that you place in your code. The type of output may vary slightly for different languages. For more information about a specific language, see the debugging topics for that language.

The output displayed in the Output window may be generated by several different sources. Output from each source is displayed on a separate page within the Output window. You can switch between output pages by selecting them from the list at the top of the Output window.

The contents of the Output window is cleared each time you run or compile your application. You can cut or copy text from the Output window or delete the text at any time.

Some compilers may also direct task-oriented output to the Task List window instead of the Output window. For example, misspelled variable names or improper syntax might generate an item in the Task List to allow you to easily correct your mistake. In some cases a message may also be generated in the Output window; the exact behavior is dependent on the language engine.

To view the Output Window

  • Choose Output from the Other Windows submenu, available from the View menu.


Viewing the Call Stack

The Call Stack helps you trace the operation of an application as it executes a series of nested procedures. The Call Stack window shows a list of all active procedure calls or stack frames for the current thread of execution. Active procedure calls are the procedures in the application that were started but not completed. The Call Stack places the earliest active procedure call at the bottom of the list and adds subsequent procedure calls to the top of the list.

The information given for each procedure begins with the name of the procedure, followed by the language engine that is executing the procedure. For multithreaded applications, selecting a thread from the Threads list makes that thread active and gives it the focus in the integrated development environment. The contents of the Call Stack will change to reflect active procedure calls for the newly selected thread.

Note If you put the application in break mode during an idle loop, no entries appear in the Call Stack dialog box.

To view the Call Stack

  • Choose Call Stack from the Debug Windows submenu, available from the View menu.


Viewing Variables in the Autos Window

The Autos window displays the values of all variables that are within the scope of currently executing procedures. Where the Locals window shows variables for a single thread, the Autos window shows variables for all threads. This window allows you to learn about the changes to a variable that may be caused by code executing on a different thread. A variable remains visible as long as it is in scope, reflecting any changes to its value. When the variable goes out of scope it is removed from the Autos window.

To view the Autos window

  • Choose Auto from the Debug Windows submenu, available from the View menu.


White Space Glyphs

The following glyphs appear when you turn on visible white space by holding down the CTRL key and pressing RW or by choosing Advanced from the Edit menu and then choosing View White Space.

This glyph | Represents
 | Space
 | Tab
 | End of file


Window Management

There are a variety of ways to manage the tool and document windows in your program and to maximize your workspace. Tool windows are windows added by the development environment (for example, the Project Explorer). Document windows are windows that contain items that you create (for example, a form). You can dock or link the tool windows to minimize window clutter, and you can view only the windows you need. You can also customize your window preferences so that each time you open the development environment, you view the windows you want.

In addition, there are two development interface modes: MDI (Multiple Document Interface) and SDI (Single Document Interface). In MDI mode your desktop has one window that contains the other windows you have open. In SDI mode every window you have open appears separately on the desktop.

Windows

Tool Windows

Tool windows are defined by the application and its add-ins. The tool windows are listed in the View menu. They can be shown, hidden, docked, linked, or moved outside the application area and viewed on another monitor. Although you cannot maximize or minimize a tool window, you can resize it. The new size becomes part of your current view. When a tool window is active, you can make changes to it. For example, you can add items and projects to the Project Explorer when it is active. You can make tool windows dockable or undockable by selecting or clearing the Dockable command on the Windows menu. When a tool window is dockable, it floats on top of the other windows or it snaps to a side of the application window. To move a dockable window without snapping it into place, press CTRL while dragging it to the location you desire. When tool windows are no longer dockable, they behave like document windows, appearing on the Windows list of the Windows menu.

Document Windows

Document windows are dynamically created when you open or create files or other items. When a document window is visible, the file is considered open and you can edit it. Closing a document window also closes the file. The current list of document windows appears in the Windows menu in the order in which they are opened, with the currently open window at the top of the list. The active document window also has a check mark to the left of it.

Document windows exist only inside the application's available client area. You can close, resize, maximize, and minimize document windows, but you cannot hide, link, or dock them.

Linking Windows

You can link tool windows together by dragging one window over another. There are two types of linking: linked windows and tabbed linked windows. When you link windows horizontally, they appear as one window, with the title bar as the separator. Tabbed linked windows appear as one window, with tabs that allow you to navigate to the other linked windows.

Multiple Monitors

On platforms that support multiple monitors, you can move your windows to multiple monitors by dragging the window to the other monitors. You can position the windows where you want them on the different monitors and their positions will be saved.

Full Screen Mode

Full Screen mode makes the active document window full screen hiding all adornments of the main application window, including all toolbars, the title bar, all tool windows, the status bar, and the Windows taskbar. The z-order is retained so that your list of windows on the Window menu remains in the order in which they were opened. Any changes you make to your workspace in Full Screen mode are saved when you leave it.

To change to full screen mode

  • Choose Full Screen from the View menu.

When you are in Full Screen mode, a toolbar with the Full Screen button appears on top of the window. Click the Full Screen button to leave Full Screen mode.