-- 作者:天一生水
-- 发布时间:2021/9/30 12:05:00
-- [求助]拖拽文件夹报错
老师好!
以前代码运行正常,现在发布时报错,请老师看看是哪里的问题?
谢谢!
1、全局代码:
Public Sub TextBox_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Dim path As String = CType(e.Data.GetData(System.Windows.Forms.DataFormats.FileDrop), System.Array).GetValue(0).ToString() sender.Text = path sender.Cursor = System.Windows.Forms.Cursors.IBeam End Sub
Public Sub picture_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) If (e.Data.GetDataPresent(System.Windows.Forms.DataFormats.FileDrop)) Then e.Effect = System.Windows.Forms.DragDropEffects.Link sender.Cursor = System.Windows.Forms.Cursors.Arrow Else e.Effect = e.AllowedEffect End If End Sub
2、窗口的AfterLoad ......
\'文件夹拖放 Dim t As WinForm.TextBox = e.Form.Controls("TextBox2") t.BaseControl.AllowDrop = True
AddHandler t.BaseControl.DragDrop, AddressOf TextBox_DragDrop AddHandler t.BaseControl.DragEnter, AddressOf TextBox_DragEnter
Dim ps As System.Diagnostics.Process() = System.Diagnostics.Process.GetProcesses() For Each p As System.Diagnostics.Process In ps \'output.show(p.processName) If ("WINWORD" = p.ProcessName) \'msgbox(p.MainWindowTitle) p.kill End If Next
3、报错如图:
此主题相关图片如下:123123.jpg

|