VB2005文件拖放到控件下

VB2005文件拖放到控件上Public Class Form1Private Sub TextBox1_DragDrop(ByVal sender As System.Object

VB2005文件拖放到控件上

Public Class Form1    Private Sub TextBox1_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox1.DragDrop        If e.Data.GetDataPresent(DataFormats.FileDrop) Then            Dim MyFiles() As String            MyFiles = CType(e.Data.GetData(DataFormats.FileDrop), String())            MsgBox(MyFiles(0))        End If    End Sub    Private Sub TextBox1_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox1.DragEnter        If e.Data.GetDataPresent(DataFormats.FileDrop) Then            e.Effect = DragDropEffects.All        End If    End Sub    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load        TextBox1.AllowDrop = True    End SubEnd Class