Share via


Controlling the Output Window

The Output window displays status messages for various features in the integrated development environment (IDE). These include build errors that occur when a project is compiled, and the results when TSQL syntax in a stored procedure is checked against a target database. Certain IDE features, such as the external tools features or commands invoked in the Command Window, deliver output to special Output Window panes. Output from external tools such as .bat or .com files, normally displayed in the DOS window, can display in this window as well.

The Visual Studio .NET automation model offers the following objects for controlling the Output window:

Object Name Description
OutputWindow Object Represents the Output window.
OutputWindowPanes Collection A collection containing all of the Output window panes.
OutputWindowPane Object Represents a single pane in the Output window.

In addition to controlling the contents of the Output window, you can also control its characteristics such as width and height. For more information about this, see Changing Window Characteristics.

Output Window Example

The following example demonstrates how to add a new window pane to the Output window and add some text to it:

Sub OutputWindowTest()
   ' Create a tool window handle for the Output window.
   Dim win As Window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)
   ' Create handles to the Output window and its panes.
   Dim OW As OutputWindow = win.Object
   Dim OWp As OutputWindowPane

   ' Add a new pane to the Output window.
   OWp = OW.OutputWindowPanes.Add("A New Pane")
   ' Add a line of text to the new pane.
   OWp.OutputString("Some Text")
End Sub

See Also

Changing Window Characteristics | Creating and Controlling Environment Windows | Creating Add-Ins and Wizards | Creating an Add-In | Creating a Wizard | Automation and Extensibility Reference | Automation Object Model Chart