Visual Studio Automation and Extensibility Reference
Window.Caption Property

Gets or sets the title of the window.

Namespace: EnvDTE
Assembly: EnvDTE (in envdte.dll)

Syntax

Visual Basic (Declaration)
Default Property Caption As String
Visual Basic (Usage)
Dim instance As Window
Dim value As String

value = instance

instance = value
C#
string this { get; set; }
C++
property String^ default {
    String^ get ();
    void set ([InAttribute] String^ pbstrTitle);
}
J#
/** @property */
String get_Caption ()

/** @property */
void set_Caption (/** @attribute InAttribute() */ String pbstrTitle)
JScript
function get Caption () : String

function set Caption (pbstrTitle : String)

Property Value

The title of the window.
Remarks

The Caption can be set for tool windows.

Example

Visual Basic
Sub CaptionExample()
   Dim Frame As Window
   Dim w1 As Window = _
   DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer)
   Dim w2 As Window = DTE.Windows.Item(Constants.vsWindowKindOutput)

   ' Create a linked window frame and dock Solution Explorer 
   ' and the Ouput window together inside it.
   Frame = DTE.Windows.CreateLinkedWindowFrame(w1, w2, _
   vsLinkedWindowType.vsLinkedWindowTypeDocked)
   MsgBox("Total number of windows in the linked window frame: " & _
   Frame.LinkedWindows.Count)

   ' View some window properties.
   MsgBox("Window ObjectKind property value: " & Frame.ObjectKind)
   MsgBox("Window Caption: " & Frame.Caption)

   ' Resize the entire linked window frame.
   Frame.Width = 500
   Frame.Height = 600
   Frame.Left = 100
   MsgBox("Frame height, width, and position changed.")
End Sub
See Also

Tags :


Community Content

Ahmed Chaudhary
Setting this property does not work in VS Add-Ins
Setting this property does not work in VS Add-Ins it throws an exception. If you need to modify the Visual Studio main window caption (title bar) here is one way to do it:

http://stackoverflow.com/questions/577188/how-to-change-the-title-bar-text-of-visual-studio

Tags :

Page view tracker