brLocateStr Method 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