Hide

SftDirectory 3.5 - ActiveX File/Folder Control

Display
Print

SftDirectory.Selection Property

Returns the requested selected file/folder.

Syntax

Get

VB.NETrefFolderObj = object.get_Selection(ByVal SelectionIndex As Integer) As SftDirectoryFolder
VBSet refFolderObj = object.Selection(ByVal SelectionIndex As Integer) As SftDirectoryFolder
C#.NETSftDirectoryFolder refFolderObj = object.get_Selection(int SelectionIndex);
VC++ISftDirectoryFolder* refFolderObj = object->Selection[int SelectionIndex];
ISftDirectoryFolder* refFolderObj = object->GetSelection(int SelectionIndex);
CHRESULT object->get_Selection(int SelectionIndex, ISftDirectoryFolder** refFolderObj);

object

A SftDirectory object.

SelectionIndex

The zero-based index of the selection to be returned.

refFolderObj

Returns the requested selected file/folder.

Comments

The Selection property returns the requested selected file/folder.

The SelectionCount property contains the number of currently selected files/folders. The selected files/folders can be retrieved using the Selection property.

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

    AxSftDirectory2.get_FolderList(3).Selected = True
    AxSftDirectory2.get_FolderList(5).Selected = True
End Sub

' This is another button event handler
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    ' 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)

VB6

    SftDirectory2.FolderList(3).Selected = True
    SftDirectory2.FolderList(5).Selected = True
End Sub

' This is another button event handler
Private Sub Command2_Click()
    ' 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).")

C#

    axSftDirectory2.get_FolderList(5).Selected = true;
}

// This is another button event handler
private void button2_Click(object sender, System.EventArgs e)
{
    // 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);

C++

    m_vDir2->FolderList[5]->Selected = VARIANT_TRUE;
}

// This is another button event handler
void CSelectionsDlg::OnButton2()
{
    // Show the selected file/folder (in a single selection control)
    ISftDirectoryFolderPtr pFolder;
    pFolder = m_vDir1->Selection[0];
    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)

See Also SftDirectory Object | Object Hierarchy


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