ReferencesEvents Interface
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.
Namespace: VSLangProj
Assembly: VSLangProj (in VSLangProj.dll)
Syntax
'Declaration
<GuidAttribute("1CF40C9E-D548-4B45-AD0F-3D7843F62BBB")> _
Public Interface ReferencesEvents _
Inherits _ReferencesEvents, _dispReferencesEvents_Event
[GuidAttribute("1CF40C9E-D548-4B45-AD0F-3D7843F62BBB")]
public interface ReferencesEvents : _ReferencesEvents,
_dispReferencesEvents_Event
[GuidAttribute(L"1CF40C9E-D548-4B45-AD0F-3D7843F62BBB")]
public interface class ReferencesEvents : _ReferencesEvents,
_dispReferencesEvents_Event
[<GuidAttribute("1CF40C9E-D548-4B45-AD0F-3D7843F62BBB")>]
type ReferencesEvents =
interface
interface _ReferencesEvents
interface _dispReferencesEvents_Event
end
public interface ReferencesEvents extends _ReferencesEvents, _dispReferencesEvents_Event
The ReferencesEvents type exposes the following members.
Methods
Name | Description | |
---|---|---|
add_ReferenceAdded | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispReferencesEvents_Event.) | |
add_ReferenceChanged | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispReferencesEvents_Event.) | |
add_ReferenceRemoved | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispReferencesEvents_Event.) | |
remove_ReferenceAdded | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispReferencesEvents_Event.) | |
remove_ReferenceChanged | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispReferencesEvents_Event.) | |
remove_ReferenceRemoved | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispReferencesEvents_Event.) |
Top
Events
Name | Description | |
---|---|---|
ReferenceAdded | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispReferencesEvents_Event.) | |
ReferenceChanged | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispReferencesEvents_Event.) | |
ReferenceRemoved | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispReferencesEvents_Event.) |
Top
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.
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