Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Drag and Drop
Message
General information
Forum:
ASP.NET
Category:
Forms
Title:
Miscellaneous
Thread ID:
00694248
Message ID:
00694283
Views:
11
Hi Bonnie,

I saw this bit of code a while ago and saved it for when I needed similar functionality. I haven't tried it and it is written VB.NET but see if it will work for you:
Private Sub TreeView1_DragDrop(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles TreeView1.DragDrop
      Dim oNode As TreeNode
      oNode = TreeView1.GetNodeAt(TreeView1.PointToClient(New Point(e.X,
e.Y)))
      oNode.Nodes.Add(e.Data.GetData(DataFormats.Text).ToString)
End Sub
>Anyone doing much with drag-and-drop? I'm trying to get a control on a Windows form to work. I have a TreeView on the left side, a ListView on the right ... your typical Windows Explorer type of control. I want to drag icons between the two. I've got it sort of working. I can drag icons in either direction, adding and removing them from either the TreeView or the ListView as needed. But, so far I haven't figured out how to drop a ListViewItem into any node of the Tree. I have only been able to drop it into whichever node is already selected. Obviously not all that intuitive for the user. I need to be able to expand a node if it is not already expanded and/or to have it become the selected node if the mouse hovers over it.
>
>I can't for the life of me figure out how to do this. The MouseHover() eventhandler is probably where this code goes, but I can't figure it out and I haven't been able to find any examples.
>
>Help!
>
>TIA,
>~~Bonnie
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform