This documentation is archived and is not being maintained.

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
HRESULT __stdcall Add(
   BSTR Name,
   /* [out, retval] */ WindowConfiguration** retVal
WindowConfiguration Add(
   string Name
[JScript .NET]
public function Add(
   Name : String
) : WindowConfiguration


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

Return Value

Returns a WindowConfiguration object.


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.


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
   ' Create a new window configuration
   objWinConfig = colWinConfig.Add("NewLayout")
   ' Get rid of the new window configuration
   MsgBox("Number of configurations: " & colWinConfig.count)
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
End Sub

See Also

WindowConfiguration Creation Example | WindowConfiguration Selection Example

Applies To: WindowConfigurations Collection