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