Questions on using the new Tree View Control? 
Author Message
 Questions on using the new Tree View Control?

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.



Fri, 20 Aug 2004 10:20:45 GMT  
 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.



Sun, 22 Aug 2004 09:21:45 GMT  
 Questions on using the new Tree View Control?
Thanks for your tips Mark. I will follow up on using them.

John G.


| 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.

|


| > 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.
| >
| >
| >
| >
|
|



Mon, 23 Aug 2004 12:04:01 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Visual Liking in .Net using TREE VIEW control

2. Using Tree View Control to store into database

3. Tree view control question.

4. Drag and Drop using the Tree View Control??

5. Tree View Control as file view

6. Tree control / List view in ONE control?

7. Simple Tree View Question

8. tree view question

9. USING TREE VIEWS with unbound ADO disconnected recordsets

10. Using shift key to select multiple items in a tree view

11. Tree View question

12. Tree View Question

 

 
Powered by phpBB® Forum Software