473,766 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DragDrop Question

Hi All,

My question is on DragDrop,

How would I implement a Drag from listview and Drop on Desktop or any other
folder on the computer.

The listview contains list of files, so basically I should be able to drop
those files on other folders in my computer.

I hope that's possible in .net 2.0

Thanks

Ratnesh
Apr 6 '07
10 1265

"Ratnesh Raval" <ra**********@g mail.comwrote in message
news:uv******** ******@TK2MSFTN GP02.phx.gbl...
>>>
Hi Lloyd,

The problems are,

For a drag from explorer to listview, i get the dataobjects -- which
are files.
For a drag within listview, i have to pass dataobjects -- which are
listviewitems . ( so you can drop them within another folder inside
listview)
For a drag from listview to explorer, i've to pass dataobjects -- which
are files (listviewitems but for explorer i've to pass them as files)

so basically, when dragging out from listview , I am not sure how to
detect, if somebody is going to drop them in listview itself or in the
explorer.
so i pass the items on listview to Dataobjects either as files or as
listviewitems .

I think i made it clear to understand.

Thanks
R

I am not sure why you would have to have two different situations.
Simply pick the way that works with the external program in this case
Explorer and then ensure that your application will respond in the same
manner. In my app the listview items do represent files and by creating
the dataobjects I can drag from Windows into my app and from my app into
windows.

If there is something I am missing please let me know I and I will see if
I can help.

Lloyd Sheen

my listview works as file explorer. so there are 3 situations
1. drag file from explorer -- drop in listview
2. drag file from listview ---drop in explorer.
3. drag file from listview ---drop inside the same listview but inside
some folder which is shown in the listview

if you look in your case, what if you want to move some file inside some
folder in listview itself ( not in the explorer),

if you want i will post it with codes.

R

I don't have the 3rd case in my app but it would be the same. Each
dataobject is representative of one file. Then when the drop happens each
dataobject will be a file and the app can do the appropriate thing. Perhaps
you are refering to moving a file. In that case you would get the result of
the drag / drop (not in my code) and then if a copy occurred do (most likely
nothing) , a move would delete the file in the source etc.

If you use the code and drag a file from the explorer and then return a
"Move" result you should see the file disappear from folder in explorer.
You can do the same thing in your app.

Lloyd

Apr 30 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
5845
by: Kate | last post by:
Hi: I have a form with a picture box and some command buttons to make certain shapes appear in the picture box. The shapes are drawn on blank UserControls added like this: 'at top of form module Dim WithEvents tc As testControl 'button1_click (for example)
1
2525
by: KS | last post by:
In want to visualy drag a Button to a Label and when I depress the mousebutton on top of the label I want to show some dato from the Button in a MsgBox - that's my primary goal. I have made a simple sample code - a form with a Button1, a Label1 and a Timer1. The Button1 has Tag="SomeData", the Label1 has AllowDrop=True and the Timer1 has an Interval=20.
0
1275
by: | last post by:
I create an user control (combined form with many controls) where I process the private void DatasetControl_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) private void DatasetControl_DragEnter(object sender, System.Windows.Forms.DragEventArgs e) Now I drop this Dataset Conttrol on my main form, and I also want to process
4
3971
by: Owe Armandt | last post by:
When I play with DragDrop of files to a form I get two DragEnter events before the DragDrop event, why is this?? Owe
0
1322
by: Flack | last post by:
Hello, Is it possible to find out how many methods are listening to a certain event? For example, if a number of methods subscribed to a controls DragDrop event using +=, can I find out how many methods in total are listening to the DragDrop event of the control? If I can't find out the exact number of methods listening to the DragDrop event, can I somehow remove all listeners of that event at once? I tried using m_Control.DragDrop =...
0
1018
by: Gene Hubert | last post by:
Well, it seems fundamental to me anyway. Hopefully it is simple enough. The question is for when the source for the dragdrop is a different application that the target for the dragdrop. How does the source for the dragdrop operation know that a drop has been completed onto a valid target? And then, how does the source know what the drop target is? I've got dragdrop working within my application but I can't see any
3
3794
by: Gary Dunne | last post by:
I'm writing an app that requires drag and drop operation between a ListView and a TreeView control. (The source is the ListView). During the drag drop operation I want to be able to detect the target node in the treeview and auto expand it if applicable... but after a fair bit of head scratching I can't find any easy way to accomplish this. I think what i really need is the equivalent of the HitTest method from the COM version of the...
7
4007
by: JohnR | last post by:
I am using dragdrop to drag and drop a custom class instance. When I drag/drop from one window to another window in the same application everything works fine. But when trying to move between the same windows running in different instances of the application the "dropped" data comes across as a system.__ComObject and I can't CType it to my class to extract the data. I've been searching for hours and haven't found any solution so I am...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
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,...
0
10008
jinu1996
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...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7381
isladogs
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...
0
6651
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();...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.