vb拖放实现

Imports Microsoft.Office.Interop.Excel
Imports Microsoft.Office.Interop
Public Class Form1

   

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        ListBox1.AllowDrop = True
    End Sub

    Private Sub ListBox1_DragDrop(sender As Object, e As DragEventArgs) Handles ListBox1.DragDrop
        For Each item As String In e.Data.GetData(DataFormats.FileDrop)
            ListBox1.Items.Add(item)
        Next
    End Sub

    Private Sub ListBox1_DragEnter(sender As Object, e As DragEventArgs) Handles ListBox1.DragEnter
        e.Effect = DragDropEffects.Copy
    End Sub

    Private Sub Copyfullname_Click(sender As Object, e As EventArgs) Handles Copyfullname.Click
        Dim cc As String
        For Each item As String In ListBox1.Items
            cc = cc & item & vbCrLf
        Next
        ' MsgBox(cc)
        Clipboard.Clear()
        Clipboard.SetText(cc)


    End Sub

    Private Sub copyname_Click(sender As Object, e As EventArgs) Handles copyname.Click
        Dim cc As String

        For Each item As String In ListBox1.Items
            cc = cc & IO.Path.GetFileNameWithoutExtension(item) & vbCrLf
        Next
        ' MsgBox(cc)
        Clipboard.Clear()
        Clipboard.SetText(cc)
    End Sub
End Class

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值