ComponentOne True DataControl 8.0
DeleteRows Method (XArrayDB)

Syntax

XArrayDB.DeleteRows (index, [count])

Method applies to XArrayDB object.

Arguments

index is a long integer specifying the index of the first row to be deleted.

count is an optional long integer specifying the number of rows to be deleted. If omitted, this argument defaults to 1.

Return Value

A long integer specifying the number of rows successfully deleted.

Description

This method deletes count rows from an XArrayDB object starting at row index and returns the number of rows successfully deleted.

Example

The following example initializes an XArrayDB object with 10 rows and 6 columns, then removes the first three rows:

MyArray.ReDim 1, 10, 1, 6

Dim i, j As Integer

For i = 1 To 10

    For j = 1 To 6

        MyArray(i, j) = "Row " & i & ", Col " & j

    Next j

Next i

Debug.Print MyArray(1, 1)          ' prints Row 1, Col 1

Debug.Print MyArray(2, 1)          ' prints Row 2, Col 1

Debug.Print MyArray(8, 1)          ' prints Row 8, Col 1

 

' remove three rows starting at index 1

Dim result As Long

result = MyArray.DeleteRows(1, 3)

Debug.Print result                 ' prints 3

Debug.Print MyArray.Count(1)       ' prints 7

Debug.Print MyArray(1, 1)          ' prints Row 4, Col 1

Debug.Print MyArray(2, 1)          ' prints Row 5, Col 1

 

' the next line now gives a "Subscript out of range" error

Debug.Print MyArray(8, 1)

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback