IndexOf Method (ActiveX)

Provides the index of an entry in the File Dependency List.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.IndexOf(Feature, FullFileName)
object

Type: FileDependencies

The object this method applies to.

Feature

Access: Input-only

Type: String

The feature name of the entry.

FullFileName

Access: Input-only

Type: String

The full path of the entry.

Return Value (RetVal)

Type: Long

Index of the entry.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_IndexOf()
    'This example adds an entry to the File Dependency List, returns its Index, updates
    'the entry, and then removes the entry.
        
    ThisDrawing.Application.Documents.Open ("c:\program files\autocad\sample\city map.dwg")
    ThisDrawing.Application.ZoomAll
    
    Dim objFDLCol As AutoCAD.AcadFileDependencies
    Dim objFDL As AutoCAD.AcadFileDependency
    
    Set objFDLCol = ThisDrawing.FileDependencies
    MsgBox ("The number of entries in the File Dependency List is " & objFDLCol.Count & ".")
    
    Dim FDLIndex As Long
    FDLIndex = objFDLCol.CreateEntry("acad:xref", "c:\referenced.dwg", True, True)
    MsgBox ("The number of entries in the File Dependency List is " & objFDLCol.Count & ".")
    
    Dim IndexNumber As Long
    IndexNumber = objFDLCol.IndexOf("acad:xref", "c:\referenced.dwg")
    Dim IndexString As String
    IndexString = CStr(IndexNumber)
    MsgBox ("The index of the new entry is " & IndexString & ".")
    
    objFDLCol.UpdateEntry (FDLIndex)
    
    objFDLCol.RemoveEntry FDLIndex, True
    MsgBox ("The number of entries in the File Dependency List is " & objFDLCol.Count & ".")
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_IndexOf()
    ;; This example adds an entry to the File Dependency List, returns its Index, updates
    ;; the entry, and then removes the entry.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    (setq objFDLCol (vla-get-FileDependencies doc))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))
    
    (setq FDLIndex (vla-CreateEntry objFDLCol "acad:xref"
                                   (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\Exterior Elevations.dwg") :vlax-true :vlax-true))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))
    
    (setq IndexNumber (vla-IndexOf objFDLCol "acad:xref" (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\Exterior Elevations.dwg")))
    (alert (strcat "The index of the new entry is " (itoa IndexNumber) "."))
    
    (vla-UpdateEntry objFDLCol FDLIndex)
    
    (vla-RemoveEntry objFDLCol FDLIndex :vlax-true)
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))
)