ComponentOne List 8.0 for ActiveX
Inserting and Removing XArrayDB Rows

When inserting or deleting rows, you must ReBind the list afterwards, since it does not receive any notifications from the XArrayDB object. Note that a list Refresh is not sufficient in this case, since the dimensions of the XArrayDB object have been changed.

The following example implements a command button that inserts a new row before the current list row, and then sets focus to the list:

Example Title
Copy Code
Private Sub Command1_Click()

    With TDBList1

        MyArray.InsertRows .Bookmark

        .ReBind

        .SetFocus

    End With

End Sub

The InsertRows method requires a row index argument that specifies the position of the new row. This method also accepts an optional second argument that specifies the number of rows to insert. If omitted, this argument defaults to 1.

When a new row is inserted, all subsequent rows are shifted to make room for it. That is, if you insert a row at index position 6, the former row 6 becomes row 7, the former row 7 becomes row 8, and so forth.

To add one or more rows to the end of an XArrayDB object, use the AppendRows method. This method accepts one optional argument that specifies the number of rows to append. If omitted, this argument defaults to 1.

To delete the current row, you could use the DeleteRows method of XArrayDB, then ReBind the list.

For backward compatibility, the Insert and Delete methods of the original XArray object were retained in XArrayDB.

 

 


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

Product Support Forum  |  Documentation Feedback