Share via


VSProjectEvents.ImportsEvents Property

Definition

Gets an ImportsEvents object that provides access to the Imports object events.

public:
 property VSLangProj::ImportsEvents ^ ImportsEvents { VSLangProj::ImportsEvents ^ get(); };
public:
 property VSLangProj::ImportsEvents ^ ImportsEvents { VSLangProj::ImportsEvents ^ get(); };
[System.Runtime.InteropServices.DispId(3)]
public VSLangProj.ImportsEvents ImportsEvents { [System.Runtime.InteropServices.DispId(3)] get; }
[<System.Runtime.InteropServices.DispId(3)>]
[<get: System.Runtime.InteropServices.DispId(3)>]
member this.ImportsEvents : VSLangProj.ImportsEvents
Public ReadOnly Property ImportsEvents As ImportsEvents

Property Value

Returns an ImportsEvents object.

Attributes

Examples

This example connects event-handling methods to the ImportAdded and ImportRemoved for a specific project using the Events object.

' Macro editor  
' This example adds event handlers to the two events in  
' ImportsEvents.  
Imports VSLangProj  
Sub ImportAdded(ByVal addedImport As String)  
   MsgBox("The import '" & addedImport & "' was added.")  
End Sub  

Sub ImportRemoved(ByVal removedImport As String)  
   MsgBox("The import '" & removedImport & "' was removed.")  
End Sub  

Sub ConnectImportsEvents()  
   Dim proj As Project = DTE.Solution.Projects.Item(1)  
   Dim vsproj As VSProject = CType(proj.Object, VSProject)  
   Dim impEvents As ImportsEvents = vsproj.Events.ImportsEvents  
   AddHandler impEvents.ImportAdded, AddressOf ImportAdded  
   AddHandler impEvents.ImportRemoved, AddressOf ImportRemoved  
End Sub  

Remarks

The ImportsEvents object provides access to two events, ImportAdded and ImportRemoved.

Applies to