property ExDataObjectFiles.Count as Long

Returns the number of file names in the collection.

TypeDescription
Long A long value that indicates the count of elements into collection.

The Count property specifies the number of files in the Files object. In order to enable OLE drag and drop feature into control you have to check the OLEDropMode property. Use the SelText property to insert text at cursor position. The control fires the OLEDragDrop event when the user drags data to the control. Use the Item property to access a file giving its index. You can use "for each" statement to enumerate the files in the ExDataObjectFiles collection. 

The following VB sample inserts the names of the files being dragged at the cursor position:

Private Sub Expression1_OLEDragDrop(ByVal Data As EXPRESSIONLibCtl.IExDataObject, Effect As Long, ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    If (Data.GetFormat(exCFFiles)) Then
        With Data.Files
            Dim i As Long, s As String
            s = ""
            For i = 0 To .Count - 1
                s = s + .Item(i) + vbCrLf
            Next
            Expression1.SelText = s
        End With
    End If
End Sub

The following C++ sample inserts the names of the files being dragged at the cursor position:

void OnOLEDragDropExpression1(LPDISPATCH Data, long FAR* Effect, short Button, short Shift, long X, long Y) 
{
	if ( EXPRESSIONLib::IExDataObjectPtr spData( Data ) )
		if ( spData->GetFormat( EXPRESSIONLib::exCFFiles ) )
		{
			EXPRESSIONLib::IExDataObjectFilesPtr spFiles = spData->Files;
			if ( spFiles != NULL )
			{
				CString s;
				for ( long i = 0; i < spFiles->Count; i++ )
					s += spFiles->Item[i];
				m_edit.SetSelText( s );
			}
		}
}

the sample needs to include definitions for IExDataObject and IExDataObjectFiles objects, by using the #import <expression.dll> statement. The #import <expression.dll> includes the EXPRESSIONLib namespace where are defined all objects in the control's type library.

The following VB.NET sample inserts the names of the files being dragged at the cursor position:

Private Sub AxExpression1_OLEDragDrop(ByVal sender As Object, ByVal e As AxEXPRESSIONLib._IExpressionEvents_OLEDragDropEvent) Handles AxExpression1.OLEDragDrop
    If (e.data.GetFormat(EXPRESSIONLib.exClipboardFormatEnum.exCFFiles)) Then
        With e.data.Files
            Dim i As Long, s As String = ""
            For i = 0 To .Count - 1
                s = s + .Item(i) + vbCrLf
            Next
            AxExpression1.SelText = s
        End With
    End If
End Sub

The following C# sample inserts the names of the files being dragged at the cursor position:

private void axExpression1_OLEDragDrop(object sender, AxEXPRESSIONLib._IExpressionEvents_OLEDragDropEvent e)
{
	if (e.data.GetFormat(Convert.ToInt16(EXPRESSIONLib.exClipboardFormatEnum.exCFFiles)))
	{
		EXPRESSIONLib.IExDataObjectFiles files = e.data.Files;
		if (files != null)
		{
			string s = "";
			for (int i = 0; i < files.Count; i++)
				s += files[i] + "\r\n";
			axExpression1.SelText = s;
		}
	}
}

The following VFP sample inserts the names of the files being dragged at the cursor position:

*** ActiveX Control Event ***
LPARAMETERS data, effect, button, shift, x, y

if ( data.GetFormat( 15 ) ) then 
	local i, s
	s = ""
	with data.Files
	for i = 0 to .Count - 1
		s = s + .Item(i) + chr(13) + chr(10)
	next
	thisform.Expression1.SelText = s
	endwith
endif