Export (0) Print
Expand All
Cut
Run
Expand Minimize

Add Method (WindowConfigurations Collection)

Visual Studio .NET 2003

Creates a new named window configuration based on the current arrangement of windows, adds it to the WindowConfigurations collection, and retains it for future recall.

[Visual Basic .NET]
Public Function Add( _
   ByVal Name As String _
) As WindowConfiguration
[Visual Basic 6]
Function Add( _
   ByVal Name As String _
) As WindowConfiguration
[C++]
HRESULT __stdcall Add(
   BSTR Name,
   /* [out, retval] */ WindowConfiguration** retVal
);
[C#]
WindowConfiguration Add(
   string Name
);
[JScript .NET]
public function Add(
   Name : String
) : WindowConfiguration

Parameters

Name
Required. A string representing the name of the new window configuration.

Return Value

Returns a WindowConfiguration object.

Remarks

You can save your current window layout in the Visual Studio environment as a named window configuration. The Add method allows you to save this configuration for later recall using the Apply method.

Example

Sub AddExample()
   ' Set references to all necessary objects.
   Dim colWinConfig As WindowConfigurations
   Dim objWinConfig As WindowConfiguration

   colWinConfig = DTE.WindowConfigurations

   MsgBox("Number of configurations: " & colWinConfig.count)
   ' List all saved named window configurations
   FillMsg(colWinConfig)
   ' Create a new window configuration
   objWinConfig = colWinConfig.Add("NewLayout")
   FillMsg(colWinConfig)
   ' Get rid of the new window configuration
   objWinConfig.Delete()
   MsgBox("Number of configurations: " & colWinConfig.count)
   FillMsg(colWinConfig)
End Sub

Sub FillMsg(ByVal colWinConfig As Object)
   ' Lists all currently available named window configurations
   Dim lCtr As Long
   Dim strMsg As String

   For lCtr = 1 To colWinConfig.count
      strMsg = strMsg & "Configuration name " & lCtr & ": " & colWinConfig.Item(lCtr).Name & vbCr
   Next lCtr
   strMsg = "Current Configurations: " & vbCr & strMsg
   MsgBox(strMsg)
End Sub

See Also

WindowConfiguration Creation Example | WindowConfiguration Selection Example

Applies To: WindowConfigurations Collection

Show:
© 2015 Microsoft