473,657 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

i need to implement drag and drop in treeview in VB

i need to implement drag and drop in treeview in VB.
Kindly help.
My treeview contains activities maintained using XML Files.
Hopefully, Thanks.

Aug 7 '06 #1
1 1869
Hi Pooja-

You can implement drag and drop with the DataObject (the "clipboard" ).

In the form that hosts the TreeView control (perhaps in the TreeViews
MouseMove Event):

Private Sub treeFileInfoTre e_MouseMove(ByV al sender As Object, ByVal e As
System.Windows. Forms.MouseEven tArgs) Handles treeFileInfoTre e.MouseMove

Dim tBase as TreeView
Dim data as New DataObject
'If no mouse button pressed, then assume no dragdrop
If e.Button = MouseButtons.No ne Then Exit Sub
tBase = DirectCast(send er, TreeView)
'Exit sub if button pressed but mouse is not over treeview node
If tBase.SelectedN ode.Bounds.Cont ains(e.X, e.Y) Then Exit Sub
'Assign data to clipboard
data.SetData(Da taFormats.Text, tBase.SelectedN ode.Text)
'Begin Drag Operation
Dim effect As DragDropEffects = DragDropEffects .Copy
effect = tBase.DoDragDro p(data, effect) 'wait here until drop complete

End Sub

Then you need to add code to the DragDrop event of the control where the
drop is occuring:

Private Sub ListBox1_DragDr op(ByVal sender As Object, ByVal e As
System.Windows. Forms.DragEvent Args) Handles lstOriginal.Dra gDrop

Dim lBase As ListBox = DirectCast(send er, ListBox)
lBase.Items.Add (e.Data.GetData (DataFormats.Te xt).ToString)

End Sub

"pooja" wrote:
i need to implement drag and drop in treeview in VB.
Kindly help.
My treeview contains activities maintained using XML Files.
Hopefully, Thanks.

Aug 7 '06 #2

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

Similar topics

2
2764
by: Peter Flickinger | last post by:
I have been using a label with the TreeView control - to simulate the ghost image of a node during drag/drop (so that a ghost of the node appears to be floating next to the cursor on a drag/drop). This works peachy when I had a form that used the TreeView control (from Microsoft). The time came that I needed to change the TreeView - so I created a control that inherited from the TreeView class.
1
2535
by: Kevin Henkener | last post by:
I would like to be able to drag-n-drop System.Windows.Forms.TreeNode objects between two different applications (actually the same application, just two instances of it) in C#. I've seen posts in which people advise that this process is no different the intra-application drag-n-drop process. I've had no luck with this concept. In fact, when I drag a node from application A's TreeView to application B's TreeView and call the GetData...
0
2415
by: Norbert Heidbüchel | last post by:
Hi all, I have read a lot of postings and web pages about drag and drop and treeviews, but could not find an answer to my problem. Sorry, if I missed something. I am trying to drag and drop treenodes defined by myself and don't understand, how to get the nodes data in the dragdrop event. I'm not very experienced in .NET and for sure there is a simple solution. I've written a short sample program, based on well known examples,
4
2197
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.
1
3498
by: emferrari | last post by:
Hi everybody I have two treeviews, one of them is only to receive items dragged from the treeview1. I want to know how to drag a full node information to the treeview2. I know how to do that only in a single node operation. Here is my current code: private void trv_Directories_ItemDrag(object sender, ItemDragEventArgs e)
2
1586
by: Yoshitha | last post by:
Hi In my application am using list box and treeview controls list box contains the files and the treeview contains files,folderrs and subfolders. I'll select a file from listbox and drag it and then i'll place(drop) that file in the any folder or subfolder which are presented in treeview control. Can anybody tell me how to do this one.
1
1164
by: vinaykumar Maladkar | last post by:
Hi Friends, I m uisng visual studio 2005 and C#. I m showing some values say 1 to 10 in a treeview control. and i want to implement drag and drop facility. i.e. any number can be moved to any position. How do i do this?
0
1735
by: munishbatra2002 | last post by:
hi all, we are using a gridview and a treeview control ... we want to drag a row from gridview control and drop it onto treeview control on a web page... we are using C# ASP.NET ... can anyone help how to drag and drop an item from gridview to treeview using javascript .. we are able to drop onto a particular area ( e:g a label), but itsn't possible to drop that item onto a particular node in treeview control ..
2
3366
by: bob | last post by:
Hi all, I have a treeview that has drag drop. Works well enough but... If you drag out of bounds of the treeview the nodrop icon comes on. Fair enough. But when I move back inside the treeview the nodrop icon stays on and essentially the action is cancelled when I release the mouse. I would like to somehow 'retrieve' the drag action when the mouse moves back inside the treeview to a legitimate drop point. Any thoughts on how to do this...
0
8425
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
8326
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
8845
Oralloy
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...
1
8522
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
8622
tracyyun
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...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1736
bsmnconsultancy
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.