Share via


_dispVCProjectEngineEvents.ItemRenamed(Object, Object, String) Method

Definition

Signifies that the specified item in the project was renamed.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 void ItemRenamed(System::Object ^ Item, System::Object ^ ItemParent, System::String ^ OldName);
public:
 void ItemRenamed(Platform::Object ^ Item, Platform::Object ^ ItemParent, Platform::String ^ OldName);
void ItemRenamed(winrt::Windows::Foundation::IInspectable const & Item, winrt::Windows::Foundation::IInspectable const & ItemParent, std::wstring const & OldName);
[System.Runtime.InteropServices.DispId(277)]
public void ItemRenamed (object Item, object ItemParent, string OldName);
[<System.Runtime.InteropServices.DispId(277)>]
abstract member ItemRenamed : obj * obj * string -> unit
Public Sub ItemRenamed (Item As Object, ItemParent As Object, OldName As String)

Parameters

Item
Object

Required. The item.

ItemParent
Object

Required. The item's parent.

OldName
String

Required. The previous name.

Attributes

Examples

[Visual Basic]

' add reference to Microsoft.VisualStudio.VCProjectEngine  
Imports EnvDTE  
Imports Microsoft.VisualStudio.VCProjectEngine  

Public Module Module1  
    Sub ItemRenamed(ByVal item As Object, ByVal ItemParent As Object, ByVal OldName As String)  
        Dim vcitem As VCProjectItem  
        vcitem = item  
        MsgBox(vcitem.ItemName)  
    End Sub  

    Sub Main()  
        Dim projEngine As VCProjectEngine  
        Dim evt As VCProjectEngineEvents  
        Dim prj As VCProject  
        Dim col As IVCCollection  
        Dim folder As VCFilter  
        prj = DTE.Solution.Projects.Item(1).Object  
        projEngine = prj.VCProjectEngine  
        col = prj.Filters  
        evt = projEngine.Events  
        AddHandler evt.ItemRenamed, AddressOf ItemRenamed  
        folder = col.Item("MyFolder")  
        folder.Name = "MyNewFolderName"  
    End Sub  
End Module  

Remarks

The ItemRenamed method fires when an item is renamed in a VCProject, VCFilter, or VCFile object.

Applies to