共用方式為


My.Computer.Clipboard.GetFileDropList Method 

Retrieves a collection of strings representing file names from the Clipboard.

' Usage
Dim value As System.Collections.Specialized.StringCollection = My.Computer.Clipboard.GetFileDropList()
' Declaration
Public Function GetFileDropList() As System.Collections.Specialized.StringCollection

Return Value

StringCollection

Remarks

This method is available only for non-server applications.

A file drop list is a collection of strings containing path information for files.

Example

This example determines if there is a file drop list on the Clipboard and adds the list to the ListBox lstFiles if they exist.

If My.Computer.Clipboard.ContainsFileDropList Then
   Dim filelist As System.Collections.Specialized.StringCollection
   filelist = My.Computer.Clipboard.GetFileDropList()
   For Each filePath As String In filelist
       lstFiles.Items.Add(filePath)
   Next
End If

This code creates an exception if there is no ListBox named lstFiles.

Requirements

Namespace: Microsoft.VisualBasic.MyServices

Class: ClipboardProxy (provides access to Clipboard)

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

Availability by Project Type

Project type Available

Windows Application

Yes

Class Library

Yes

Console Application

Yes

Windows Control Library

Yes

Web Control Library

No

Windows Service

Yes

Web Site

No

Permissions

No permissions are required.

See Also

Reference

My.Computer.Clipboard Object
My.Computer.Clipboard.ContainsFileDropList Method
My.Computer.Clipboard.SetFileDropList Method
System.Collections.Specialized.StringCollection
System.Windows.Forms.Clipboard.GetFileDropList

Other Resources

Storing Data to and Reading From the Clipboard