VSLangProjWebReferencesEvents Interface

Provides access to events that are raised by adding, deleting, or changing project web references.

Namespace:  VSLangProj80
Assembly:  VSLangProj80 (in VSLangProj80.dll)

Syntax

'Declaration
<GuidAttribute("33BD7FEF-EEB4-412A-A4C1-9FBFF6F57067")> _
Public Interface VSLangProjWebReferencesEvents _
    Inherits _VSLangProjWebReferencesEvents, _dispVSLangProjWebReferencesEvents_Event
'Usage
Dim instance As VSLangProjWebReferencesEvents
[GuidAttribute("33BD7FEF-EEB4-412A-A4C1-9FBFF6F57067")]
public interface VSLangProjWebReferencesEvents : _VSLangProjWebReferencesEvents, 
    _dispVSLangProjWebReferencesEvents_Event
[GuidAttribute(L"33BD7FEF-EEB4-412A-A4C1-9FBFF6F57067")]
public interface class VSLangProjWebReferencesEvents : _VSLangProjWebReferencesEvents, 
    _dispVSLangProjWebReferencesEvents_Event
public interface VSLangProjWebReferencesEvents extends _VSLangProjWebReferencesEvents, _dispVSLangProjWebReferencesEvents_Event

Remarks

The VSLangProjWebReferencesEvents object may be accessed from either the VSProjectEvents2 object or the DTE object.

This object has the following events:

Examples

This example connects event-handling methods for a specific project by using the VSLangProjWebReferencesEvents property. For more information on 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 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, C#, or J# rpoject.
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

See Also

Reference

VSLangProjWebReferencesEvents Members

VSLangProj80 Namespace

VSProjectEvents2

Other Resources

How to: Respond to Web References Events (Visual Basic)

How to: Respond to Web References Events (Visual C#)