Hide

SftDirectory 3.5 - ActiveX File/Folder Control

Display
Print

Selections Sample (VB.NET)

This sample illustrates working with selections.

This is not an executable sample, so a complete project is not provided. These statements are intended to show the syntax used.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ' This sample uses 2 SftDirectory controls
    ' SftDirectory1 allows single selection only
    AxSftDirectory1.MultiSelect = SftDirectoryMultiSelectConstants.selectSftDirectorySingle
    ' SftDirectory2 allows multiple selection
    AxSftDirectory2.MultiSelect = SftDirectoryMultiSelectConstants.selectSftDirectoryMultiple
End Sub

' This is a button event handler
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    ' Select one file/folder (in a single selection control)
    AxSftDirectory1.get_FolderList(1).Selected = True
    ' Select a few files/folders (in a multiple selection control)
    AxSftDirectory2.get_FolderList(1).Selected = True
    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)
        MessageBox.Show("""" & F.Name & """ is selected (in the multiple selection control).")
    Next
End Sub

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