
Questions on using the new Tree View Control?
It did take some time to get used to. All in all I found the older version
easier to work with and Infragistics version even better. I have not tried
their new control nor any of the other 3rd party trees.
Regarding your questions:
1. You should look at the Before and After Select options which fire when
nodes are selected.
2. Drag and Drop is indeed supported. There are three area you need to look
at. These look something like this:
Private Sub tvPlanItems_ItemDrag(ByVal sender As Object, ByVal e As
System.Windows.Forms.ItemDragEventArgs) Handles tvPlanItems.ItemDrag
DoDragDrop(e.Item, DragDropEffects.Copy)
End Sub
Private Sub tvPlanItems_DragEnter(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles tvPlanItems.DragEnter
e.Effect = DragDropEffects.Copy
End Sub
Private Sub tvPlanItems_DragDrop(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles tvPlanItems.DragDrop
Try
If e.Data.GetDataPresent("TreeNode", False) Then
Try
Dim pt As Point
pt = CType(sender, TreeView).PointToClient(New
Point(e.X, e.Y))
DestinationNode = CType(CType(sender,
TreeView).GetNodeAt(pt), TreeNode)
..now do something...like add the Selected Node in the
Tree to the Nodes collection of the Destination Node
...etc...
....I got the framework for this from earlier posts here
and on a web search..though I can't remember where now....Google may help.
3. I have not had to deal with this but I suppose you could create your own
collection that stored some key to the Tree nodes, using a custom Node class
(see Treeview control/adding custom information" in the Help file), or or
the Tag property and then search that collection.
There were some postings on the TreeView control a few months back that
helped me out. You may be able to find them doing a Google newsgroup search.
I hope this gives you some help on getting started.
Good luck,
Mark Lewis
President
Mark D. Lewis Inc.
Quote:
> I have been reading the discussions and can not see much on tree view. I
> have a few questions and I need some ideas.
> I had been using VB6 tree view a lot and liked it. Now the VB.NET tree
view
> has me frustrated.
> 1 - How can I detect when a user has clicked on a node?
> 2 - Does the tree view control support drag and drop any more?
> 3 - What are people doing now that the tree view does not support keys to
> find node.
> Is there a straight forward way to get back the VB6 tree view control?
> All help and advice is welcomed.
> John G.