Hide

SftBox/OCX 5.0 - Combo Box Control

Display
Print

DataObject.Files Property

Returns a collection of filenames used by the sftCFFiles format.

Syntax

Get

VB.NETFiles = object.Files As DataObjectFiles
VBSet Files = object.Files As DataObjectFiles
C#.NETDataObjectFiles Files = object.Files;
VC++IVDMDataObjectFiles* Files = object->Files;
IVDMDataObjectFiles* Files = object->GetFiles();
CHRESULT object->get_Files(struct IVDMDataObjectFiles** Files);

object

A DataObject object.

Files

Returns a DataObjectFiles object reference which can be used to access the file names in the collection.

Comments

The Files property returns a collection of filenames used by the sftCFFiles format.

The Files collection is filled with file names only when the DataObject object contains data of type sftCFFiles. The DataObject object can contain several different types of data. You can iterate through the Files collection using the DataObjectFiles.Item property to retrieve the list of file names.

The Files collection can be filled to allow an application to act as a drag source for a list of files (similar to Windows Explorer).

Examples

VB.NET

        Dim o As Object = e.data.GetData(SftOLEClipboardConstants.sftCFBitmap)
        comboTarget.get_Item(itemIndex).Image.Picture = o 'as stdole.IPictureDisp
        comboTarget.Items.Selection = itemIndex
    End If
    If e.data.GetFormat(SftOLEClipboardConstants.sftCFFiles) Then
        Dim itemIndex As Integer = -1
        Dim toIndex As Integer = comboTarget.Items.DropIndex
        Dim s As String
        For Each s In e.data.Files
            itemIndex = comboTarget.Items.Insert(s, toIndex)
            toIndex = toIndex + 1
        Next
        comboTarget.Items.Selection = itemIndex
    End If
    comboTarget.Columns.MakeOptimal(0)
    comboTarget.Items.RecalcHorizontalExtent(0)

VB6

    If Data.GetFormat(sftCFDIB) Then
        ItemIndex = ComboTarget.Items.Insert("A Bitmap", ComboTarget.Items.DropIndex)
        Set ComboTarget.Item(ItemIndex).Image.Picture = Data.GetData(sftCFDIB)
        ComboTarget.Items.Selection = ItemIndex
    End If
    If Data.GetFormat(sftCFFiles) Then
        Dim vData As Variant, ToIndex As Long
        ToIndex = ComboTarget.Items.DropIndex
        For Each vData In Data.Files
            ItemIndex = ComboTarget.Items.Insert(vData, ToIndex)
            ToIndex = ToIndex + 1
        Next
        ComboTarget.Items.Selection = ItemIndex
    End If
    ComboTarget.Columns.MakeOptimal 0
    ComboTarget.Items.RecalcHorizontalExtent 0

C#

        int itemIndex = comboTarget.Items.Insert("A Bitmap", comboTarget.Items.DropIndex);
        object o = e.data.GetData(SftOLEClipboardConstants.sftCFBitmap);
        comboTarget.get_Item(itemIndex).Image.Picture = o as stdole.IPictureDisp;
        comboTarget.Items.Selection = itemIndex;
    }
    if (e.data.GetFormat((short) SftOLEClipboardConstants.sftCFFiles)) {
        int itemIndex = -1;
        int toIndex = comboTarget.Items.DropIndex;
        foreach (string s in e.data.Files) {
            itemIndex = comboTarget.Items.Insert(s, toIndex);
            toIndex = toIndex + 1;
        }
        comboTarget.Items.Selection = itemIndex;
    }
    comboTarget.Columns.MakeOptimal(0);
    comboTarget.Items.RecalcHorizontalExtent(0);

See Also DataObject Object | Object Hierarchy


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