Hide

SftDirectory 3.5 - ActiveX File/Folder Control

Display
Print

SftDirectoryFolder.Name Property

Defines the file/folder's name (including extension, if any).

Syntax

Get

VB.NETString = object.Name As String
VBString = object.Name As String
C#.NETstring String = object.Name;
VC++_bstr_t String = object->Name;
_bstr_t String = object->GetName();
CHRESULT object->get_Name(BSTR* String);

Put

VB.NETobject.Name = String As String
VBobject.Name = String As String
C#.NETstring object.Name = String;
VC++_bstr_t object->Name = String;
void object->PutName(_bstr_t String);
CHRESULT object->put_Name(BSTR String);

object

A SftDirectoryFolder object.

String

Defines the file/folder's name.

Comments

The Name property defines the file/folder's name (including extension, if any).

When setting the Name property, the file/folder is renamed. Only a relative folder name can be used (not an absolute path name).

The FileName and FileExt properties can be use to retrieve just the file name or extension.

To retrieve the file/folder name as it is displayed to the user, also use GetText(contentsSftDirectoryName).

The file/folder's full path can be retrieved using the Path property.

Examples

VB.NET

    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

    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#

// 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);
        MessageBox.Show("\"" + F.Name + "\" is selected (in the multiple selection control).");
    }
}

C++

// 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)
    int i;
    for (i = 0 ; i < m_vDir2->SelectionCount ; ++ i) {
        pFolder = m_vDir2->Selection[i];

See Also SftDirectoryFolder Object | Object Hierarchy


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