PC Review


Reply
Thread Tools Rate Thread

i need to implement drag and drop in treeview in VB

 
 
pooja
Guest
Posts: n/a
 
      7th Aug 2006
i need to implement drag and drop in treeview in VB.
Kindly help.
My treeview contains activities maintained using XML Files.
Hopefully, Thanks.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?cmVkZWFnbGU=?=
Guest
Posts: n/a
 
      7th Aug 2006
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 treeFileInfoTree_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles treeFileInfoTree.MouseMove

Dim tBase as TreeView
Dim data as New DataObject
'If no mouse button pressed, then assume no dragdrop
If e.Button = MouseButtons.None Then Exit Sub
tBase = DirectCast(sender, TreeView)
'Exit sub if button pressed but mouse is not over treeview node
If tBase.SelectedNode.Bounds.Contains(e.X, e.Y) Then Exit Sub
'Assign data to clipboard
data.SetData(DataFormats.Text, tBase.SelectedNode.Text)
'Begin Drag Operation
Dim effect As DragDropEffects = DragDropEffects.Copy
effect = tBase.DoDragDrop(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_DragDrop(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles lstOriginal.DragDrop

Dim lBase As ListBox = DirectCast(sender, ListBox)
lBase.Items.Add(e.Data.GetData(DataFormats.Text).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.
>
>

 
Reply With Quote
 
 
 
Reply

« SPAM | select stmt »
Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Recreate a >>C# WinForms<< TreeView "state" -after- treeview rebuild ?? Any TreeView GODS out there ?? frostbb Microsoft C# .NET 6 18th Aug 2008 05:08 PM
Drag and Drop Column headers (drag and drop using wndProc?) KamiiKoneko@gmail.com Microsoft Dot NET Framework Forms 0 17th Dec 2007 03:28 PM
Access denied trying to "md"? Drag & Drop is now drag, drop, OK, OK ???? Noozer Windows Vista Installation 0 17th Oct 2006 10:45 AM
How to implement drag n drop events in AXWEBBROWSER Sindbaad Microsoft VB .NET 0 5th Feb 2005 08:02 PM
Re: Implement Drag and Drop in CF Andrew McGrath Microsoft Dot NET Compact Framework 0 29th Aug 2003 11:42 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:42 PM.