Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 6th, 2007, 02:03 AM
Registered User
 
Join Date: Apr 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to thew00tman
Default Drag and Drop Files

I have an application that i want to be able to drag a file from explorer, and drop it into a box on my form.

I set the box's OLEDropMode to 1 - Manual, so it allows things to be dropped.

I just need to know how to retrieve the filename that is being dropped.


I am pretty new to VB, so please tell me if I am just crazy :P

You don't know.
 
Old April 16th, 2007, 09:37 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Conceptually, this is a simple thing.

The file names are contained in the Files collection of the DataObject paramter that is the first parameter of the OLEDragDrop event handler for the control you want to drop on.

For example, if you have a text control named TextControl1 on your form, you would use this code to see this working:

Code:
Private Sub Text1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
    Text1.Text = Data.Files(1)
End Sub
Of course, you will want to add error handling, as well as to actually code the behaviors you want.

Woody Z
http://www.learntoprogramnow.com
How to use a forum to help solve problems





Similar Threads
Thread Thread Starter Forum Replies Last Post
Drag and Drop batott ASP.NET 2.0 Professional 3 April 26th, 2008 07:59 PM
Drag and drop vpinhao Beginning VB 6 0 September 11th, 2006 01:33 PM
Drag/Drop bmains Javascript 1 September 22nd, 2004 07:29 PM
Drag and Drop from PictureBox hary Pro VB.NET 2002/2003 1 July 25th, 2004 08:49 AM
Drag and drop Clive Astley Access 2 August 15th, 2003 12:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.