|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
i need to implement drag and drop in treeview in VBi need to implement drag and drop in treeview in VB.
Kindly help. My treeview contains activities maintained using XML Files. Hopefully, Thanks. 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 Show quoteHide quote "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. > >
Update problem ADO vbnet 2005
About Adding controls dynamically Altering function of keypress for listbox Getting database fields (rows) to appear as columns in datagrid Convert DAO from VB6 to VB8? Hyperlink and Label Update a structure when another structure changes Cache panels Route planning Newbie help with the imports statement |
|||||||||||||||||||||||