ComponentOne True DataControl 8.0
DeleteColumns Method (XArrayDB)

Syntax

XArrayDB.DeleteColumns (index, [count])

Method applies to XArrayDB object.

Arguments

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

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

Return Value

A long integer specifying the number of columns successfully deleted.

Description

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

Example

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

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, 4)          ' prints Row 1, Col 4

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

 

' remove two columns starting at index 4

Dim result As Long

result = MyArray.DeleteColumns(4, 2)

Debug.Print result                 ' prints 2

Debug.Print MyArray.Count(2)       ' prints 4

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

 

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

Debug.Print MyArray(1, 5)

 

 


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

Product Support Forum  |  Documentation Feedback