brReplace Method Example

Sub Main()

Dim oEnv As New clsD3Environment

Dim oConn As clsD3Connection

Dim oArray As New clsD3DynamicArray

Dim oContinent As New clsD3DynamicArray

Dim lFound As Long

 

Set oConn = oEnv.brOpenConnection("ODBC", "production”)

 

oArray.brCString = "Europe" & D3VMChr & "South America" & D3VMChr & "Africa" 

oContinent.brCString = InputBox("Enter a continent")

If oArray.brLocate(oContinent, lFound, 1) = True Then

oContinent.brCString = InputBox(oContinent.brCString & " is already there. Enter replacement")

oArray.brReplace oContinent, 1, lFound

Else

oArray.brInsert oContinent, -1

End If

 

MsgBox oArray.brCString

 

oEnv.brCloseConnection oConn

Set oArray = Nothing

Set oContinent = Nothing

Set oEnv = Nothing

End Sub