Hide

SftBox/OCX 5.0 - Combo Box Control

Display
Print

SftBoxItems.Select Method

Searches items using text and selects the item found.

Syntax

VB.NETFoundIndex = object.Select(ByVal Text As String, ByVal StartIndex As Integer, ByVal ColNum As Short, ByVal Wrap As Boolean, ByVal IgnoreCase As Boolean, ByVal Exact As Boolean) As Integer
VBFoundIndex = object.Select(ByVal Text As String, ByVal StartIndex As Long, ByVal ColNum As Integer, ByVal Wrap As Boolean, ByVal IgnoreCase As Boolean, ByVal Exact As Boolean) As Long
C#.NETint FoundIndex = object.Select(string Text, int StartIndex, short ColNum, bool Wrap, bool IgnoreCase, bool Exact);
VC++long FoundIndex = object->Select(_bstr_t Text, long StartIndex, short ColNum, VARIANT_BOOL Wrap, VARIANT_BOOL IgnoreCase, VARIANT_BOOL Exact);
CHRESULT object->raw_Select(BSTR Text, long StartIndex, short ColNum, VARIANT_BOOL Wrap, VARIANT_BOOL IgnoreCase, VARIANT_BOOL Exact, long* FoundIndex);

object

A SftBoxItems object.

Text

The text to be searched.

StartIndex

The zero-based index of the item where the search is to begin (including the item at StartIndex).

ColNum

The zero-based index of the column to be searched. Only cells in this column will be searched and only one column can be searched at a time.

Wrap

Specify True to allow the search to wrap around and begin at the first item when the end of the list is reached. If False is specified, the search will end at the end of the list.

IgnoreCase

Specify True to compare Text and the cell text of each item ignoring differences between uppercase and lowercase characters. Specify False for a case sensitive comparison.

Exact

If True is specified, Text must match the cell text completely (still depending on IgnoreCase). If False is specified, the Select method will select the first item whose cell text starts with Text.

FoundIndex

Returns the zero-based index of the item found and selected. -1 is returned if no match was found.

Comments

The Select method searches items using text and selects the item found.

The string described by Text is compared to the Cell.Text property of all items involved in the search. The search starts at the item described by StartIndex and is restricted to the column specified by ColNum. If an item with a matching Cell.Text property is found, it is selected and its zero-based index is returned, otherwise -1 is returned.

Only one column can be searched at a time. The comparison of Text and the Cell.Text property may be case sensitive based on the IgnoreCase argument.

If the Cell.Text starts with the string in Text, it is considered a match if Exact is False. If Exact is True, the Cell.Text property must be completely equal to Text.

Examples

VB.NET

    AddCompany("Wolski  Zajazd", "Zbyszek Piestrzeniewicz", "Owner", "ul. Filtrowa 68", "Warszawa", "", "01-012", "Poland", "(26) 642-7012", "(26) 642-7012")
    companyList.BulkUpdate = False

    companyList.Columns.MakeOptimal(0)
    companyList.Items.RecalcHorizontalExtent(0)
    PerformSort(0, SftBoxSortConstants.sortSftBoxAscending)
    ' Adjust horizontal extent so we can scroll to the right edge of the header
    companyList.Items.HorizontalExtent = companyList.Items.HorizontalExtent + companyList.Width
    companyList.Items.Select("Softel vdm, Inc.", 0, 0, False, True, False)


    countryList.Items.Add("Austria")
    countryList.Items.Add("Australia")
    countryList.Items.Add("Belgium")
    countryList.Items.Add("Canada")
    countryList.Items.Add("Switzerland")

VB6

    SortedColumn = 0
    CompanyList.Header(SortedColumn).Image.Appearance = sftImageSortAsc
    PerformSort

    CompanyList.Columns.MakeOptimal 0
    CompanyList.Items.RecalcHorizontalExtent 0
    ' Adjust horizontal extent so we can scroll to the right edge of the header
    CompanyList.Items.HorizontalExtent = CompanyList.Items.HorizontalExtent + (CompanyList.Width / Screen.TwipsPerPixelX)
    CompanyList.Items.Select "Softel vdm, Inc.", 0, 0, False, True, False

    With CountryList.Items
        .Add "Austria"
        .Add "Australia"
        .Add "Belgium"
        .Add "Canada"
        .Add "Switzerland"

C#

    AddCompany("Wolski  Zajazd", "Zbyszek Piestrzeniewicz", "Owner", "ul. Filtrowa 68", "Warszawa", "", "01-012", "Poland", "(26) 642-7012", "(26) 642-7012");
    companyList.BulkUpdate = false;

    companyList.Columns.MakeOptimal(0);
    companyList.Items.RecalcHorizontalExtent(0);
    PerformSort(0, SftBoxSortConstants.sortSftBoxAscending);
    // Adjust horizontal extent so we can scroll to the right edge of the header
    companyList.Items.HorizontalExtent = companyList.Items.HorizontalExtent + companyList.Width;
    companyList.Items.Select("Softel vdm, Inc.", 0, 0, false, true, false);


    countryList.Items.Add("Austria");
    countryList.Items.Add("Australia");
    countryList.Items.Add("Belgium");
    countryList.Items.Add("Canada");
    countryList.Items.Add("Switzerland");

C++

    vCompanyList->Columns->MakeOptimal(0);
    vCompanyList->Items->RecalcHorizontalExtent(0);
    PerformSort(0, sortSftBoxAscending);
    // Adjust horizontal extent so we can scroll to the right edge of the header
    CRect rect;
    m_CompanyList.GetClientRect(&rect);
    vCompanyList->Items->HorizontalExtent = vCompanyList->Items->HorizontalExtent + rect.Width();
    vCompanyList->Items->Select("Softel vdm, Inc.", 0, 0, VARIANT_FALSE, VARIANT_TRUE, VARIANT_FALSE);

    ISftBoxPtr vCountryList = m_CountryList.GetControlUnknown();

    vCountryList->PutFont(NULL);
    vCountryList->Edit->PutFont(NULL);
    vCountryList->Items->Add("Austria");
    vCountryList->Items->Add("Australia");
    vCountryList->Items->Add("Belgium");

See Also SftBoxItems Object | Object Hierarchy


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