16,554
社区成员
发帖
与我相关
我的任务
分享
'设置ListBoxFF控件的:AllowDrop = True
Private Sub ListBoxFF_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBoxFF.DragDrop
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
Me.ListBoxFF.Items.Clear()
Dim MyFiles() As String
Dim i As Integer
MyFiles = e.Data.GetData(DataFormats.FileDrop)
For i = 0 To MyFiles.Length - 1
If String.Equals(Path.GetExtension(MyFiles(i)).ToLower, ".xls") Then
Me.ListBoxFF.Items.Add(MyFiles(i))
End If
Next
End If
End Sub
Private Sub ListBoxFF_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBoxFF.DragEnter
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.All
End If
End Sub