VB获取文件路径
3个回答
展开全部
先设置文本框的OLEDropMode = 1
然后参考以下代码:
Private Sub Label2_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
Label2.Caption = Data.Files(1)
End Sub
然后参考以下代码:
Private Sub Label2_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
Label2.Caption = Data.Files(1)
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
在窗体中添加一个list1
然后先设置窗体的OLEDropMode为1-Manual
然后在代码中添加
Private Sub Form_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim thisfile As Variant
For Each thisfile In Data.Files
List1.AddItem thisfile
Next
End Sub
当你把文件拖到窗体上放下的时候,list1里就会添加一个文件路径
然后先设置窗体的OLEDropMode为1-Manual
然后在代码中添加
Private Sub Form_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim thisfile As Variant
For Each thisfile In Data.Files
List1.AddItem thisfile
Next
End Sub
当你把文件拖到窗体上放下的时候,list1里就会添加一个文件路径
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
'先添加个 Text1
Private Sub Form_Load()
OLEDropMode = 1
End Sub
Private Sub Form_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim thisfile As Variant
For Each thisfile In Data.Files
Text1.Text = thisfile
Next
End Sub
Private Sub Form_Load()
OLEDropMode = 1
End Sub
Private Sub Form_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim thisfile As Variant
For Each thisfile In Data.Files
Text1.Text = thisfile
Next
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询