SftBox/OCX 4.5

SftBoxItems.InsertAfter Method

Softel vdm, Inc.

Inserts a new item following the specified index position.

Syntax       

VB.NET

ItemIndex = object.InsertAfter(ByVal Text As String, ByVal AfterIndex As Integer)  As Integer

VB

ItemIndex = object.InsertAfter(ByVal Text As String, ByVal AfterIndex As Long)  As Long

C#.NET

int ItemIndex = object.InsertAfter(string Text, int AfterIndex);

VC++

long ItemIndex = object->InsertAfter(_bstr_t Text, long AfterIndex);

C

HRESULT object->raw_InsertAfter(BSTR Text, long AfterIndex, long* ItemIndex);

Delphi

ItemIndex := object.InsertAfter(Text : WideString; AfterIndex : Integer)   : Integer;

object

A SftBoxItems object.

Text

The text to be added as cell text of the first (or only) column of the item.

AfterIndex

The zero-based index of the position after which the item will be inserted. Specify -1 to add the item at the end of the list.

ItemIndex

Returns the zero-based index of the newly inserted item.

Comments

The InsertAfter method inserts a new item following the specified index position.

New items added using the InsertAfter method are added after the position described by AfterIndex. By default, new items are added at level 0. Use the Item.Level property to change an item's level.

Items can be inserter before a specific item using the Items.Insert method.

If many items have to be added, the BulkUpdate property can be used to indicate a mass-update, which is significantly faster.

Once an item has been added, the Cell.Text property can be used to change the text for any of the available cells.

Items can be added at the end using the Items.Add method. Items can be deleted using the Items.Remove or Items.Clear methods.

When a control is populated using Items.Add or Items.Insert, the Items.RecalcHorizontalExtent method can be used to have the control calculate the optimal horizontal scrolling area so scroll bars are enabled, depending on the Scrollbars property.

The drop down portion is automatically hidden when the combo box contents are changed using this method. The DropDown.SuppressOn method can be used to suppress hiding the drop down portion when adding/inserting items.


Feedback / comments / error reports for this topic
© 2008 - Softel vdm, Inc. - www.softelvdm.com