Engines.Item Method

Gets an indexed member of a Engines collection.

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

Syntax

'Declaration
Function Item ( _
    index As Object _
) As Engine
Engine Item(
    Object index
)
Engine^ Item(
    [InAttribute] Object^ index
)
abstract Item : 
        index:Object -> Engine 
function Item(
    index : Object
) : Engine

Parameters

Return Value

Type: EnvDTE80.Engine
A Engine object.

Remarks

The value for Index can be:

  • A BSTR representing the first few letters of the full name of the engine.

  • A BSTR representing the GUID of the engine.

  • A 1-based integer value

The Item method throws a ArgumentException exception if the collection cannot find the object that corresponds to the index value.

Note

When you record a macro and attach to a debugging process using the T-SQL debugging engine, the macro returns two separate references to the same engine name. For example, dbgeng(0) = transprt.Engines.Item("T-SQL") and dbgeng(1) = transprt.Engines.Item("T-SQL"). This happens because there are actually two underlying T-SQL debugging engines in Visual Studio: one for the SQL Server 2005 debugging engine, the other for the T-SQL debugging engine for SQL Server 2000 and SQL Server 7. They are both automatically referenced when attaching to a debugging engine process via the UI, but in automation code, they must each be referenced by using their unique identifier GUID. The GUID for SQL Server 2005 is {1202F5B4-3522-4149-BAD8-58B2079D704F}, and the GUID for the T-SQL debugging engine for SQL Server 2000 and SQL Server 7 is {5AF6F83C-B555-11D1-8418-00C04FA302A1}. So the above calls should be changed to dbgeng(0) = trans.Engines.Item("{1202F5B4-3522-4149-BAD8-58B2079D704F}") and dbgeng(1) = trans.Engines.Item("{1202F5B4-3522-4149-BAD8-58B2079D704F}") respectively.

Examples

' Macro code.
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics
Imports Microsoft.VisualBasic.ControlChars

Public Module Module1

    Sub ShowDefaultEngines()
        Dim dbg As EnvDTE80.Debugger2
        dbg = DTE.Debugger

        dbg.HexDisplayMode = True

        Dim transport As EnvDTE80.Transport
        transport = dbg.Transports.Item("default")

        Dim engine As EnvDTE80.Engine
        Dim strEngineList As String
        For Each engine In transport.Engines
            strEngineList = strEngineList + engine.Name + ", " + _
            engine.ID + ", " + engine.AttachResult.ToString + NewLine
        Next
        MsgBox(strEngineList)
    End Sub
End Module

.NET Framework Security

See Also

Reference

Engines Interface

EnvDTE80 Namespace