brLocateStr method

Searches for the location of a specific string in a clsD3DynamicArray object.

Syntax

bValue = object.brLocateStr( sFind, nFound, [ vnAMC], [ vnVMC], [ vnStart])

Parameters

Parameter Description
bValue The return value is a Boolean data type that is True if sFind is found in object.
object An object variable that represents a clsD3DynamicArray object to be searched.
sFind A String that specifies the element to be found.
nFound A Long indicating the position where sFind was found. If not found, this variable defaults to the end of the dynamic array. This is an output-only parameter.
vnAMC Optional. A Variant (Integer subtype) specifying the attribute to be searched.
vnVMC Optional. A Variant (Integer subtype) specifying the value to be searched.
vnStart Optional. A Variant (Integer subtype) specifying the first field from which to begin the search.

Remarks

This method has the same functionality as brLocate. The difference between the two methods is the way the element to be located is passed. In the brLocateStr method, the element is passed as a string (sfind). In the brLocate method, the element is passed as a clsD3DynamicArray object.

Example

Sub Main()
   Dim oEnv As New clsD3Environment
   Dim oConn As clsD3Connection
   Dim oArray As New clsD3DynamicArray
   Dim sContinent As String
   Dim lFound As Long
 
   Set oConn = oEnv.brOpenConnection("ODBC", "production")
 
   oArray.brCString = "Europe" & D3VMChr & "South America" & D3VMChr & "Africa"
   sContinent = InputBox("Enter a continent")
   If oArray.brLocateStr(sContinent, lFound, 1) = True Then
      sContinent = InputBox(sContinent & " is already there. Enter replacement")
      oArray.brReplaceStr sContinent, 1, lFound
   Else
      oArray.brInsertStr sContinent, -1
   End If
 
   MsgBox oArray.brCString
 
   oEnv.brCloseConnection oConn
   Set oArray = Nothing
   Set oEnv = Nothing
End Sub

FlashBASIC reference

locate – without a sequence parameter