Partager via


_CommandBars.Add Method

Adds a command bar.

Namespace:  Microsoft.VisualStudio.CommandBars
Assembly:  Microsoft.VisualStudio.CommandBars (in Microsoft.VisualStudio.CommandBars.dll)

Syntax

'Declaration
Function Add ( _
    Name As Object, _
    Position As Object, _
    MenuBar As Object, _
    Temporary As Object _
) As CommandBar
CommandBar Add(
    Object Name,
    Object Position,
    Object MenuBar,
    Object Temporary
)
CommandBar^ Add(
    [InAttribute] Object^ Name, 
    [InAttribute] Object^ Position, 
    [InAttribute] Object^ MenuBar, 
    [InAttribute] Object^ Temporary
)
abstract Add : 
        Name:Object * 
        Position:Object * 
        MenuBar:Object * 
        Temporary:Object -> CommandBar
function Add(
    Name : Object, 
    Position : Object, 
    MenuBar : Object, 
    Temporary : Object
) : CommandBar

Parameters

  • Name
    Type: Object

    [in, optional] The name of the command bar. If this parameter is not specified, a unique name is generated.

  • Position
    Type: Object

    [in, optional] The MsoBarPosition of the new command bar. If this parameter is not specified the default value is msoBarFloating.

  • MenuBar
    Type: Object

    [in, optional] Whether the new bar is a menu or not.  Visual Studio does not support adding menus with this method; the value must be false.

  • Temporary
    Type: Object

    [in, optional] Whether the new control will be present in future sessions of Visual Studio. If this parameter is not specified, the default value is false.

Return Value

Type: Microsoft.VisualStudio.CommandBars.CommandBar
The newly-added CommandBar.

Remarks

The command bar that is added by using this method is a temporary command bar, which appears only when the add-in is loaded.

For more information about adding and removing permanent and temporary command bars, see HOWTO: Adding buttons, commandbars and toolbars to Visual Studio .NET from an add-in and HOWTO: Removing commands and UI elements during Visual Studio .NET add-in uninstallation.

.NET Framework Security

See Also

Reference

_CommandBars Interface

Microsoft.VisualStudio.CommandBars Namespace