This documentation is archived and is not being maintained.

Location Property

Visual Studio .NET 2003

Returns the location of the parent object declaration.

[Visual Basic .NET]
Public ReadOnly Property Location( _
   Optional ByVal Where As vsCMWhere = vsCMWhereDefault _
) As String
[Visual Basic 6]
Property Get Location( _
   Optional ByVal Where As vsCMWhere = vsCMWhereDefault _
) As String
HRESULT __stdcall get_Location(
   vsCMWhere Where,
   /* [out, retval] */ BSTR* retVal
public string Location(
   vsCMWhere Where
) {get;}
[JScript .NET]
public function get Location(
   Where : vsCMWhere
) : String


Optional. A vsCMWhere value specifying whether the location of the declaration or the definition is returned.


This example displays the file containing the declaration for each top-level code element.

Sub DisplayLocation()
    Dim vcCM As VCCodeModel
    Dim vcCodeElement As VCCodeElement
    vcCM = DTE.Solution.Item(1).CodeModel
    For Each vcCodeElement In vcCM.CodeElements
        MsgBox(vcCodeElement.Name + " is declared in " + vcCodeElement.Location)
End Sub

See Visual C++ Code Model Samples for information on how to compile and run this sample.

See Also

Applies To: VCCodeAttribute Object | VCCodeBase Object | VCCodeClass Object | VCCodeDelegate Object | VCCodeElement Object | VCCodeEnum Object | VCCodeEvent Object | VCCodeFunction Object | VCCodeIDLCoClass Object | VCCodeIDLImport Object | VCCodeIDLImportLib Object | VCCodeIDLLibrary Object | VCCodeImport Object | VCCodeInclude Object | VCCodeInterface Object | VCCodeMacro Object | VCCodeMap Object | VCCodeMapEntry Object | VCCodeNamespace Object | VCCodeParameter Object | VCCodeProperty Object | VCCodeStruct Object | VCCodeTypedef Object | VCCodeUnion Object | VCCodeUsing Object | VCCodeVariable Object