Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Gets a ReferencesEvents object that provides access to the events of the References collection.
Namespace:  VSLangProj80
Assembly:  VSLangProj80 (in VSLangProj80.dll)
Syntax
'Declaration
ReadOnly Property ReferencesEvents As ReferencesEvents
'Usage
Dim instance As VSProjectEvents2 
Dim value As ReferencesEvents 
value = instance.ReferencesEvents
ReferencesEvents ReferencesEvents { get; }
property ReferencesEvents^ ReferencesEvents {
    ReferencesEvents^ get ();
}
function get ReferencesEvents () : ReferencesEvents
Property Value
Type: VSLangProj.ReferencesEvents
Returns a ReferencesEvents object.
Implements
VSProjectEvents.ReferencesEvents
Remarks
The ReferencesEvents property provides access to three events: ReferenceAdded, ReferenceChanged, and ReferenceRemoved.
Examples
This example connects event-handling methods for a specific project by using the ReferencesEvents property. For more information about how to run macro samples, see How to: Compile and Run the Automation Object Model Code Examples.
Open a Visual Basic, Visual C#, or Visual J# project before running this macro.
' Macro Editor
' Connects trivial methods to the ReferenceAdded and ReferenceDeleted
' events of the first project in the solution.
Imports VSLangProj
Imports VSLangProj80
Sub ConnectEvents()
   Dim proj As Project = DTE.Solution.Projects.Item(1)
   Dim vsproj As VSProject2 = CType(proj.Object, VSProject2)
   Dim refEvents As ReferencesEvents = vsproj.Events.ReferencesEvents
   AddHandler refEvents.ReferenceAdded, AddressOf ReferenceAdded
   AddHandler refEvents.ReferenceRemoved, AddressOf ReferenceRemoved
   AddHandler refEvents.ReferenceChanged, AddressOf ReferenceChanged
End Sub
Sub ReferenceRemoved(ByVal removedRef As Reference)
   MsgBox("The reference for " & removedRef.Name & " was removed.")
End Sub
Sub ReferenceChanged(ByVal removedRef As Reference)
   MsgBox("The reference for " & removedRef.Name & " was changed.")
End Sub
Sub ReferenceAdded(ByVal addedRef As Reference)
   MsgBox("The reference for " & addedRef.Name & " was added.")
End Sub
.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.