_dispVCProjectEngineEvents.ItemAdded Method
This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Signifies that the specified item was added to the project.
Namespace: Microsoft.VisualStudio.VCProjectEngine
Assembly: Microsoft.VisualStudio.VCProjectEngine (in Microsoft.VisualStudio.VCProjectEngine.dll)
Syntax
'Declaración
Sub ItemAdded ( _
Item As Object, _
ItemParent As Object _
)
void ItemAdded(
Object Item,
Object ItemParent
)
void ItemAdded(
[InAttribute] Object^ Item,
[InAttribute] Object^ ItemParent
)
abstract ItemAdded :
Item:Object *
ItemParent:Object -> unit
function ItemAdded(
Item : Object,
ItemParent : Object
)
Parameters
- Item
Type: System.Object
Required. The item that was added.
- ItemParent
Type: System.Object
Required. The item's parent.
Remarks
ItemAdded fires when an item is added to a VCProject, VCFilter, or VCFile.
Examples
[Visual Basic]
' add reference to Microsoft.VisualStudio.VCProjectEngine
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine
Public Module Module1
Sub ItemAdded(ByVal item As Object, ByVal parent As Object)
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
projEngine = DTE.Solution.Projects.Item(1).Object.VCProjectEngine
prj = DTE.Solution.Projects.Item(1).Object
evt = projEngine.Events
AddHandler evt.ItemAdded, AddressOf ItemAdded
prj.AddFile("myfile")
End Sub
End Module
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.