共用方式為


My.Computer.Clipboard.SetFileDropList Method 

Writes a collection of strings representing file paths to the Clipboard.

' Usage
My.Computer.Clipboard.SetFileDropList(filePaths)
' Declaration
Public Sub SetFileDropList( _
   ByVal filePaths As System.Collections.Specialized.StringCollection _
)

Parameters

Remarks

A file drop list is a collection of strings representing file names.

Security noteSecurity Note

Because the Clipboard can be accessed by other users, do not use it to store sensitive information, such as passwords or confidential data.

Example

This example gets the collection of file names from MyDocuments, converts it to a file drop list, and writes it to the Clipboard.

Dim list As System.Collections.ObjectModel.ReadOnlyCollection(Of String)
list = My.Computer.FileSystem.GetFiles _
(My.Computer.FileSystem.SpecialDirectories.MyDocuments)
Dim listReader As New System.Collections.Specialized.StringCollection
For Each item As String In list
   listReader.Add(item)
Next
My.Computer.Clipboard.SetFileDropList(listReader)

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.GetFileDropList Method
System.Collections.Specialized.StringCollection
SetFileDropList

Other Resources

Storing Data to and Reading From the Clipboard