IDTExtensibility2..::.OnConnection Method Home
This page is specific to:.NET Framework Version:2.03.54.0
Visual Studio Automation and Extensibility Reference
IDTExtensibility2..::.OnConnection Method

Occurs whenever an add-in is loaded into Visual Studio.

Namespace:  Extensibility
Assembly:  Extensibility (in Extensibility.dll)
Syntax

'Usage

Dim instance As IDTExtensibility2
Dim Application As Object
Dim ConnectMode As ext_ConnectMode
Dim AddInInst As Object
Dim custom As Array

instance.OnConnection(Application, ConnectMode, _
    AddInInst, custom)

'Declaration

Sub OnConnection ( _
    Application As Object, _
    ConnectMode As ext_ConnectMode, _
    AddInInst As Object, _
    ByRef custom As Array _
)

Parameters

Application
Type: System..::.Object
A reference to an instance of the integrated development environment (IDE), DTE, which is the root object of the Visual Studio automation model.
ConnectMode
Type: Extensibility..::.ext_ConnectMode
An ext_ConnectMode enumeration value that indicates the way the add-in was loaded into Visual Studio.
AddInInst
Type: System..::.Object
An AddIn reference to the add-in's own instance. This is stored for later use, such as determining the parent collection for the add-in.
custom
Type: System..::.Array%
An empty array that you can use to pass host-specific data for use in the add-in.
Remarks

OnConnection is the main method for IDTExtensibility2, because it is called every time an add-in is loaded. It is the entry point for an add-in when it is loaded, so you can put any code here (or call any another function) that you want to run when the add-in starts.

Examples

Public Sub OnConnection(ByVal application As Object, ByVal _
connectMode As ext_ConnectMode, ByVal addInInst As Object, _
ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    applicationObject = CType(application, DTE2)
    addInInstance = CType(addInInst, AddIn)
    MsgBox("Add-in is connected.")
End Sub

Permissions

See Also

Reference

Other Resources

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View