共用方式為


VSLangProjWebReferencesEvents Interface

Definition

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

public interface class VSLangProjWebReferencesEvents : VSLangProj80::_dispVSLangProjWebReferencesEvents_Event, VSLangProj80::_VSLangProjWebReferencesEvents
public interface class VSLangProjWebReferencesEvents : VSLangProj80::_dispVSLangProjWebReferencesEvents_Event, VSLangProj80::_VSLangProjWebReferencesEvents
__interface VSLangProjWebReferencesEvents : VSLangProj80::_dispVSLangProjWebReferencesEvents_Event, VSLangProj80::_VSLangProjWebReferencesEvents
[System.Runtime.InteropServices.CoClass(typeof(VSLangProj80.VSLangProjWebReferencesEventsClass))]
[System.Runtime.InteropServices.Guid("33BD7FEF-EEB4-412A-A4C1-9FBFF6F57067")]
public interface VSLangProjWebReferencesEvents : VSLangProj80._dispVSLangProjWebReferencesEvents_Event, VSLangProj80._VSLangProjWebReferencesEvents
[System.Runtime.InteropServices.CoClass(typeof(VSLangProj80.VSLangProjWebReferencesEventsClass))]
[System.Runtime.InteropServices.Guid("33BD7FEF-EEB4-412A-A4C1-9FBFF6F57067")]
[System.Runtime.InteropServices.ComVisible(false)]
public interface VSLangProjWebReferencesEvents : VSLangProj80._dispVSLangProjWebReferencesEvents_Event, VSLangProj80._VSLangProjWebReferencesEvents
[<System.Runtime.InteropServices.CoClass(typeof(VSLangProj80.VSLangProjWebReferencesEventsClass))>]
[<System.Runtime.InteropServices.Guid("33BD7FEF-EEB4-412A-A4C1-9FBFF6F57067")>]
type VSLangProjWebReferencesEvents = interface
    interface _VSLangProjWebReferencesEvents
    interface _dispVSLangProjWebReferencesEvents_Event
[<System.Runtime.InteropServices.CoClass(typeof(VSLangProj80.VSLangProjWebReferencesEventsClass))>]
[<System.Runtime.InteropServices.Guid("33BD7FEF-EEB4-412A-A4C1-9FBFF6F57067")>]
[<System.Runtime.InteropServices.ComVisible(false)>]
type VSLangProjWebReferencesEvents = interface
    interface _VSLangProjWebReferencesEvents
    interface _dispVSLangProjWebReferencesEvents_Event
Public Interface VSLangProjWebReferencesEvents
Implements _dispVSLangProjWebReferencesEvents_Event, _VSLangProjWebReferencesEvents
Derived
Attributes
Implements

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 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  

Remarks

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

This object has the following events:

Methods

add_OnAfterWebReferenceAdded(_dispVSLangProjWebReferencesEvents_OnAfterWebReferenceAddedEventHandler)

For functionality, see OnAfterWebReferenceAdded(Object).

(Inherited from _dispVSLangProjWebReferencesEvents_Event)
add_OnBeforeWebReferenceRemoved(_dispVSLangProjWebReferencesEvents_OnBeforeWebReferenceRemovedEventHandler)

For functionality, see OnBeforeWebReferenceRemoved(Object).

(Inherited from _dispVSLangProjWebReferencesEvents_Event)
add_OnWebReferenceChanged(_dispVSLangProjWebReferencesEvents_OnWebReferenceChangedEventHandler)

For functionality, see OnWebReferenceChanged(Object).

(Inherited from _dispVSLangProjWebReferencesEvents_Event)
remove_OnAfterWebReferenceAdded(_dispVSLangProjWebReferencesEvents_OnAfterWebReferenceAddedEventHandler)

For functionality, see OnAfterWebReferenceAdded(Object).

(Inherited from _dispVSLangProjWebReferencesEvents_Event)
remove_OnBeforeWebReferenceRemoved(_dispVSLangProjWebReferencesEvents_OnBeforeWebReferenceRemovedEventHandler)

For functionality, see OnBeforeWebReferenceRemoved(Object).

(Inherited from _dispVSLangProjWebReferencesEvents_Event)
remove_OnWebReferenceChanged(_dispVSLangProjWebReferencesEvents_OnWebReferenceChangedEventHandler)

For functionality, see OnWebReferenceChanged(Object).

(Inherited from _dispVSLangProjWebReferencesEvents_Event)

Events

OnAfterWebReferenceAdded

For functionality, see OnAfterWebReferenceAdded(Object).

(Inherited from _dispVSLangProjWebReferencesEvents_Event)
OnBeforeWebReferenceRemoved

For functionality, see OnBeforeWebReferenceRemoved(Object).

(Inherited from _dispVSLangProjWebReferencesEvents_Event)
OnWebReferenceChanged

For functionality, see OnWebReferenceChanged(Object).

(Inherited from _dispVSLangProjWebReferencesEvents_Event)

Applies to