Hide

SftBox/OCX 5.0 - Combo Box Control

Display
Print

SftBoxItems.Clear Method

Removes all items.

Syntax

VB.NETobject.Clear()
VBobject.Clear
C#.NETvoid object.Clear();
VC++HRESULT object->Clear();
CHRESULT object->raw_Clear();

object

A SftBoxItems object.

Comments

The Clear method removes all items.

Individual items can be deleted using the Items.Remove or Item.DeleteDependents methods.

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.

Examples

VB.NET

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ' add all font information
    UpdateFontNames()
End Sub

Private Sub UpdateFontNames()
    ' add all font names
    fontNames.BulkUpdate = True
    fontNames.Items.Clear()
    fontNames.Items.AddFontNames(-1, SftBoxFontConstants.fontSftBoxAll, True, 0)
    fontNames.Items.Selection = 0
    PerformSort(fontNames, SftBoxSortConstants.sortSftBoxAscending)
    fontNames.BulkUpdate = False
    fontNames.Columns.MakeOptimal(0)
    fontNames.Items.RecalcHorizontalExtent(0)
End Sub

VB6

    Else
        SftBoxCtrl.Items.Sort -1, 0, sortSftBoxDescending
    End If
End Sub

Private Sub UpdateFontNames()
    ' add all font names
    FontNames.BulkUpdate = True
    FontNames.Items.Clear
    FontNames.Items.AddFontNames -1, fontSftBoxAll, True, 0
    FontNames.Items.Selection = 0
    PerformSort FontNames
    FontNames.BulkUpdate = False
    FontNames.Columns.MakeOptimal 0
    FontNames.Items.RecalcHorizontalExtent 0
End Sub

C#

    // add all font information
    UpdateFontNames();
}

private void UpdateFontNames()
{
    // add all font names
    fontNames.BulkUpdate = true;
    fontNames.Items.Clear();
    fontNames.Items.AddFontNames(-1, SftBoxFontConstants.fontSftBoxAll, true, 0);
    fontNames.Items.Selection = 0;
    PerformSort(fontNames, SftBoxSortConstants.sortSftBoxAscending);
    fontNames.BulkUpdate = false;
    fontNames.Columns.MakeOptimal(0);
    fontNames.Items.RecalcHorizontalExtent(0);
}

C++

}

void CFontDlgDlg::UpdateFontNames()
{
    // add all font names
    ISftBoxPtr vFontNames = m_FontNames.GetControlUnknown();

    vFontNames->BulkUpdate = VARIANT_TRUE;
    vFontNames->Items->Clear();
    vFontNames->Items->AddFontNames(-1, fontSftBoxAll, VARIANT_TRUE, 0);
    vFontNames->Items->Selection = 0;
    PerformSort(vFontNames, sortSftBoxAscending);
    vFontNames->BulkUpdate = VARIANT_FALSE;
    vFontNames->Columns->MakeOptimal(0);
    vFontNames->Items->RecalcHorizontalExtent(0);

See Also SftBoxItems Object | Object Hierarchy


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.