Hide

SftDirectory 3.5 - ActiveX File/Folder Control

Display
Print

SftDirectory.SelectionCount Property

Returns the number of selected files/folders.

Syntax

Get

VB.NETCount = object.SelectionCount As Integer
VBCount = object.SelectionCount As Integer
C#.NETint Count = object.SelectionCount;
VC++int Count = object->SelectionCount;
int Count = object->GetSelectionCount();
CHRESULT object->get_SelectionCount(int* Count);

object

A SftDirectory object.

Count

Returns the number of selected files/folders.

Comments

The SelectionCount property returns the number of selected files/folders.

The MultiSelect property defines whether only one or multiple files/folders can be selected at a time. Combo box style controls (see ControlStyle property) support single selection only.

All selections can be cleared using the ClearSelection property.

Examples

VB.NET

    ' Show the selected file/folder (in a single selection control)
    Dim F As SftDirectoryFolder
    F = AxSftDirectory1.get_Selection(0)
    If Not F Is Nothing Then
        MessageBox.Show("""" & F.Name & """ is selected (in the single selection control).")
    End If
    ' Show the selected files/folders (in a multiple selection control)
    Dim I As Integer
    For I = 0 To AxSftDirectory2.SelectionCount - 1
        F = AxSftDirectory2.get_Selection(I)
        MessageBox.Show("""" & F.Name & """ is selected (in the multiple selection control).")
    Next
End Sub

VB6

    ' Show the selected file/folder (in a single selection control)
    Dim F As SftDirectoryFolder
    Set F = SftDirectory1.Selection(0)
    If Not F Is Nothing Then
        MsgBox ("""" & F.Name & """ is selected (in the single selection control).")
    End If
    ' Show the selected files/folders (in a multiple selection control)
    Dim I As Integer
    For I = 0 To SftDirectory2.SelectionCount - 1
        MsgBox ("""" & SftDirectory2.Selection(I).Name & """ is selected (in the multiple selection control).")
    Next
End Sub

C#

    // Show the selected file/folder (in a single selection control)
    SftDirectoryFolder F;
    F = axSftDirectory1.get_Selection(0);
    if (F != null) {
        MessageBox.Show("\"" + F.Name + "\" is selected (in the single selection control).");
    }
    // Show the selected files/folders (in a multiple selection control)
    int i;
    for (i = 0 ; i < axSftDirectory2.SelectionCount ; ++i) {
        F = axSftDirectory2.get_Selection(i);
        MessageBox.Show("\"" + F.Name + "\" is selected (in the multiple selection control).");
    }
}

C++

    if (pFolder != NULL) {
        CString str;
        CString strName((LPCWSTR)pFolder->Name);
        str.Format(_T("\"%s\" is selected (in the single selection control)."), strName);
        AfxMessageBox(str);
    }
    // Show the selected files/folders (in a multiple selection control)
    int i;
    for (i = 0 ; i < m_vDir2->SelectionCount ; ++ i) {
        pFolder = m_vDir2->Selection[i];
        CString strName((LPCWSTR)pFolder->Name);
        CString str;
        str.Format(_T("\"%s\" is selected (in the multiple selection control)."), strName);
        AfxMessageBox(str);
    }
}

See Also SftDirectory Object | Object Hierarchy


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