Partager via


VSProjectEvents2.VSLangProjWebReferencesEvents Property

Definition

Gets a VSLangProjWebReferencesEvents object that provides access to Web reference events.

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

Property Value

A VSLangProjWebReferencesEvents object.

Attributes

Examples

This example connects event-handling methods for a specific project by using the VSLangProjWebReferencesEvents 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 or Visual C# project before running this macro.

' Macro code.  
' Connects trivial methods to the OnAfterWebReferenceAdded,  
' OnBeforeWebReferenceRemoved, and OnWebReferenceChanged  
' events of the first project in the solution.  
' The first project is a Visual Basic or C# project.  
Imports VSLangProj  
Imports VSLangProj80  
Sub ConnectWebEvents()  
    Dim proj As Project = DTE.Solution.Projects.Item(1)  
    Dim vsproj As VSProject2 = CType(proj.Object, VSProject2)  
    Dim refEvents As VSLangProjWebReferencesEvents = _  
    vsproj.Events2.VSLangProjWebReferencesEvents  
    AddHandler refEvents.OnAfterWebReferenceAdded, _  
    AddressOf WebReferenceAdded  
    AddHandler refEvents.OnBeforeWebReferenceRemoved, _  
    AddressOf WebReferenceRemoved  
    AddHandler refEvents.OnWebReferenceChanged, _  
    AddressOf WebReferenceChanged  
End Sub  
Sub WebReferenceRemoved(ByVal removedRef As Object)  
    MsgBox("The reference for " & removedRef.Name & " was removed.")  
End Sub  
Sub WebReferenceChanged(ByVal changedRef As Object)  
    MsgBox("The reference for " & changedRef.Name & " was changed.")  
End Sub  
Sub WebReferenceAdded(ByVal addedRef As Object)  
    MsgBox("The reference for " & addedRef.Name & " was added.")  
End Sub  

Applies to