473,889 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to create a drag and drop field for files?

Seth Schrock
2,965 Recognized Expert Specialist
I'm trying to create an easy way to get references to files into my database. I want users to be able to drag and drop a file from their desktop (or anywhere else on their computer) onto a control of some kind and have the file get placed on the server with a hyperlink in the database to the file on the server. In reading stuff online, I found out that the Hyperlink data type makes it so that you can drag a file onto a textbox and it will automatically create a hyperlink to that file. My idea was then to use that hyperlink to be able to do a FileCopy to the server and then change the value in the control to be the location on the server instead of the user's PC. When tried, the hyperlink that gets added to the text box when the file is dropped onto it is not a regular file path that FileCopy can use. It starts with ... and then the file path inside pound signs and then duplicates that again. Also, it doesn't include the starting part of the file path so I can't use Left(), Right(), or Mid() functions to parse it down to a usable file path. Now I'm out of ideas.
Mar 16 '13
25 33684
8,834 Recognized Expert Expert
@TheSmileyCoder :
Be sure to set the OLEDropMode of the TreeView to 'Manual'.
Mar 18 '13 #21
2,322 Recognized Expert Moderator Top Contributor
I got the impression from your previous post that it would be possible to have the treeview show the file paths without adding any code. I can't seem to get that functionality, and I notice that your example include code to get the filepaths.

I just want to make sure: Is there a no-code way to add the files directly to a treeview? Its merely a matter of curiosity.
Mar 18 '13 #22
5,501 Recognized Expert Moderator Expert
What I did in the test DB was drop the function in a standard module and then called it in the on_open event of the test form to set the "file://" as the base and then called the function again on the on_close event of the form to clear things back to the default state.
Mar 18 '13 #23
Seth Schrock
2,965 Recognized Expert Specialist
That would work. I had put it in the AfterUpdate event of the control, but as you can imagine, that made it work once, and then not, and then it did... I ended up just turned it on and then removed it from the event. It at least allowed me to play with the results to trim it down to get the file path without the display part and just the file name so that I can display just the name, but still have the link to the full path.

I'm in the process of creating a test database to try the listview, treeview, and just the plain method that Z has recommended to see what will fit my situation the best. I will let you know the test results once I get them.
Mar 18 '13 #24
Seth Schrock
2,965 Recognized Expert Specialist
Well, I got all three methods to work and they work well. My boss ended up liking the treeview the best so that is what I have gone with.

Thanks to everyone for you help, insight, and time spent creating samples. They were very, VERY helpful. Also, your tutorials on treeviews were a big help Smiley!
Mar 22 '13 #25
2,322 Recognized Expert Moderator Top Contributor
Always happy to be of assistance.
Mar 28 '13 #26

Sign in to post your reply or Sign up for a free account.

Similar topics

by: simon_s_li | last post by:
Hi, I have 5 fields in line where I need to drag and drop the text from one field to another field and then all the fields need to re-order themselves. So for instance if I drag the text in field 1 to field 3, then field 2 text and field 3 move to field 1 and field 2. I add the new order of text into an array so when the onDragEnd event
by: SamSpade | last post by:
There seems to be two ways to put things on the clipboard ( I don't mean different formats): SetClipboardData and OleSetClipboard If I want to get data off the clipboard do I care how it was put there? What about Drag/Drop; is there more than one way for the source to make data available Is it always OLE?
by: Qingdong Z. | last post by:
I have a VS.NET windows application which use drag-drop feather. It works fine when application start, but stops working after application run one or two days. The application is related to Video process, CPU/Memory extensive. The drag-drop is in a new windows form. It drags from TreeView Control to other control in the same form. It cannot trigger ItemDrag event of TreeView after drag-drop feather die. Can you give me any idea? Thanks.
by: Nathan | last post by:
I'm working for the first time with the DoDragDrop method. I've got almost everything worked out, but I need some help with the last bit. There are two listboxes on my form, lstGroups and lstStudents. I want to be able to drag a name from lstStudents and drop it on one of the names in lstGroups to move it to that group. I've got the dragging part working; it's just the dropping that isn't there yet. I'm working with what I can find...
by: Robin Tucker | last post by:
I've implemented an IDataObject interface around one of my classes in order to facilitate drag/drop from my application into explorer. What I want to do is allow the user to select a series of data objects in my application and to drag/drop them onto explorer for explorer to create files of them. Is this possible, or will I just have to stick with an explicit "Export" method in my program?
by: Brian Henry | last post by:
I haven't worked much with drag/drop but I am trying to make a form that accepts files to drug onto it from explorer and droped and have the form know the full path and file name of the files dropped onto it.. does anyone have any examples of this? thanks
by: .Netter | last post by:
the user of my app should be able to drag an object (e.g. a file) out of my app into another folder or another app. everywhere i found information how to drag n drop objects(files) from one control to another control in the same application but nowhere i found a hint how to drag objects (files) out of an app and drop them into another one. is someone out there who know how to do that? thanks for your help.
by: Nick | last post by:
Hi, I am developping an app using managed C++. I want to be able to do a drag drop from the app to windows explorer. The files to be dropped onto explorer do not exist yet, the files are to be created by the app when the user does the drop into explorer. I have done some searches and found COleDataSource::DelaySetData could be useful but this is MFC and I can't find the equivalent in .NET.
by: Mukesh Agarwal | last post by:
Hi, I am developing a windows application, in which I am giving two options to the user for the file selection. 1. Open File Dialog 2. Drag/ Drop Now I want that the user can Drag/Drop files from the browser which opens through Open File Dialog. This is not a default feature.
by: radhikams | last post by:
Hi I want to create a drag drop tool box using javascript... Can anyone please guide me in this regard Thanks
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.