SelectedItem.Name Property

Gets the name of the SelectedItem object.

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

Syntax

'Declaration
ReadOnly Default Property Name As String
string this { get; }
property String^ default {
    String^ get ();
}
abstract Name : string with get
function get Name () : String

Property Value

Type: System.String
A string representing the name of the SelectedItem object.

Examples

public void CodeExample(DTE2 dte)
{  
    try
    {
        // Open project and select one or more items in the
        // solution explorer before running this example.
        SelectedItem selItem;
        string msg = "";
        if (dte.SelectedItems.Count > 0)
        {
            selItem = dte.SelectedItems.Item(1);
            msg = "The first selected item is " + selItem.Name;
        }
        MessageBox.Show(msg);
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

.NET Framework Security

See Also

Reference

SelectedItem Interface

EnvDTE Namespace

Other Resources

How to: Compile and Run the Automation Object Model Code Examples