SolutionConfiguration2.Activate Method

Definition

Moves the focus to the current item.

public:
 void Activate();
public:
 void Activate();
void Activate();
[System.Runtime.InteropServices.DispId(5)]
public void Activate ();
[<System.Runtime.InteropServices.DispId(5)>]
abstract member Activate : unit -> unit
Public Sub Activate ()

Implements

Attributes

Examples

This example displays the active solution configuration item's name for the first item and then activates it. Open a project in the Visual Studio integrated development environment (IDE) before running this example.

Imports EnvDTE  
Imports EnvDTE80  
Sub SolutionConfigurationActivateExample(ByVal dte As DTE2)  
    ' Open a solution in the Visual Studio IDE  
    ' before running this example.  
    Try  
        Dim builder As SolutionBuild = _  
        _applicationObject.Solution.SolutionBuild  
        Dim config As SolutionConfiguration2  
        config = CType(builder.SolutionConfigurations.Item(1) _  
        , SolutionConfiguration2)  
        MsgBox("The first solution configuration item's name in  _  
        the collection is: " & config.Collection.Item(1).Name)  
        MsgBox("Activating the solution configuration item...")  
        config.Activate()  
    Catch ex As System.Exception  
        MsgBox(ex.ToString)  
    End Try  
End Sub  
using EnvDTE;  
using EnvDTE80;  
using System.Windows.Forms;  
public void SolutionConfigurationActivateExample(DTE2 dte)  
{  
    try  
    {  
        SolutionBuild builder =   
_applicationObject.Solution.SolutionBuild;  
        SolutionConfiguration2 config;  
        config =   
(SolutionConfiguration2)builder.SolutionConfigurations.Item(1);  
        MessageBox.Show("The first solution configuration item's   
name in the collection is: " + config.Collection.Item(1).Name);  
        MessageBox.Show("Activating the solution configuration...");  
        config.Activate();  
    }  
    catch(SystemException ex)  
    {  
        MessageBox.Show(ex.ToString());  
    }  
}  

Remarks

When Activate is invoked, it is as if the user clicked the item, but no click events occur.

Applies to