Freigeben über


ReferencesEvents Interface

Definition

Provides access to events that are raised by adding, deleting, or changing project references. Use this object for functionality and refer to ReferencesEventsClass for this object’s documentation.

public interface class ReferencesEvents : VSLangProj::_dispReferencesEvents_Event, VSLangProj::_ReferencesEvents
public interface class ReferencesEvents : VSLangProj::_dispReferencesEvents_Event, VSLangProj::_ReferencesEvents
__interface ReferencesEvents : VSLangProj::_dispReferencesEvents_Event, VSLangProj::_ReferencesEvents
[System.Runtime.InteropServices.CoClass(typeof(VSLangProj.ReferencesEventsClass))]
[System.Runtime.InteropServices.Guid("1CF40C9E-D548-4B45-AD0F-3D7843F62BBB")]
public interface ReferencesEvents : VSLangProj._dispReferencesEvents_Event, VSLangProj._ReferencesEvents
[System.Runtime.InteropServices.CoClass(typeof(VSLangProj.ReferencesEventsClass))]
[System.Runtime.InteropServices.Guid("1CF40C9E-D548-4B45-AD0F-3D7843F62BBB")]
[System.Runtime.InteropServices.ComVisible(false)]
public interface ReferencesEvents : VSLangProj._dispReferencesEvents_Event, VSLangProj._ReferencesEvents
[<System.Runtime.InteropServices.CoClass(typeof(VSLangProj.ReferencesEventsClass))>]
[<System.Runtime.InteropServices.Guid("1CF40C9E-D548-4B45-AD0F-3D7843F62BBB")>]
type ReferencesEvents = interface
    interface _ReferencesEvents
    interface _dispReferencesEvents_Event
[<System.Runtime.InteropServices.CoClass(typeof(VSLangProj.ReferencesEventsClass))>]
[<System.Runtime.InteropServices.Guid("1CF40C9E-D548-4B45-AD0F-3D7843F62BBB")>]
[<System.Runtime.InteropServices.ComVisible(false)>]
type ReferencesEvents = interface
    interface _ReferencesEvents
    interface _dispReferencesEvents_Event
Public Interface ReferencesEvents
Implements _dispReferencesEvents_Event, _ReferencesEvents
Derived
Attributes
Implements

Examples

To connect to the events of a single project using the VSProject object, see ReferencesEvents.

The following two examples use the late-bound VBReferencesEvents property to connect to Visual Basic project events. Use CSharpReferencesEvents to connect to Visual C# events.

There are two late-bound methods for handling events. The first method allows you to connect to events for a particular project and requires the Option Strict Off statement to compile. This method returns an error if the parameter to the VBReferencesEvents call is not of type Project. The parameter to VBImportsEvents is optional. If it is omitted, events for all the Visual Basic projects in the solution are received.

' Macro editor  
Imports VSLangProj  
Option Strict Off  
Dim WithEvents refEvents As ReferencesEvents  
Sub ConnectProjectRefEvents()  
   ' Must have Option Strict Off  
   Dim proj As Project = DTE.Solution.Projects.Item(1)  
   refEvents = DTE.Events.VBReferencesEvents(proj)  
End Sub  

Public Sub refEvents_ReferenceAdded(ByVal pReference _  
As VSLangProj.Reference) Handles refEvents.ReferenceAdded  
   MsgBox(pReference.Name)  
End Sub  

The second late-bound method allows you to add event-handling methods for events in all the projects in the solution. This method does not offer a way to filter events for only a particular project. It will compile with Option Strict On.

' Macro editor  
Imports VSLangProj  
Dim WithEvents refEvents As ReferencesEvents  
Sub ConnectAllRefEvents()  
   refEvents = CType(DTE.Events.GetObject("VBReferencesEvents"), _  
      ReferencesEvents)  
End Sub  

Public Sub refEvents_ReferenceAdded(ByVal pReference _  
As VSLangProj.Reference) Handles refEvents.ReferenceAdded  
   MsgBox(pReference.Name)  
End Sub  

Remarks

The ReferencesEvents object may be accessed from either the VSProject object or the DTE object. Each project, through the VSProject object, has a ReferencesEvents object providing access to the events of that project. The ReferencesEvents object of the DTE object may be used to connect to events of individual projects or to events of all Visual Basic projects in the solution.

Methods

add_ReferenceAdded(_dispReferencesEvents_ReferenceAddedEventHandler)

Microsoft Internal Use Only.

(Inherited from _dispReferencesEvents_Event)
add_ReferenceChanged(_dispReferencesEvents_ReferenceChangedEventHandler)

Microsoft Internal Use Only.

(Inherited from _dispReferencesEvents_Event)
add_ReferenceRemoved(_dispReferencesEvents_ReferenceRemovedEventHandler)

Microsoft Internal Use Only.

(Inherited from _dispReferencesEvents_Event)
remove_ReferenceAdded(_dispReferencesEvents_ReferenceAddedEventHandler)

Microsoft Internal Use Only.

(Inherited from _dispReferencesEvents_Event)
remove_ReferenceChanged(_dispReferencesEvents_ReferenceChangedEventHandler)

Microsoft Internal Use Only.

(Inherited from _dispReferencesEvents_Event)
remove_ReferenceRemoved(_dispReferencesEvents_ReferenceRemovedEventHandler)

Microsoft Internal Use Only.

(Inherited from _dispReferencesEvents_Event)

Events

ReferenceAdded

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

Microsoft Internal Use Only.

(Inherited from _dispReferencesEvents_Event)
ReferenceChanged

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

Microsoft Internal Use Only.

(Inherited from _dispReferencesEvents_Event)
ReferenceRemoved

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

Microsoft Internal Use Only.

(Inherited from _dispReferencesEvents_Event)

Applies to