473,395 Members | 1,412 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Tree view problem

Hi,
I'm using a tree view to manage my tables.
The nodes are made dynamiclly, the problem that I want to create an
event when I select a node. I used the code below
treeview.selectednode.index = 0
but when I use that code the event run on all nodes and children nodes
I want to associate an index to each node to resolve that problem
Does any one had solution
Omar Abid

Jun 14 '07 #1
3 1128
On 14 Jun, 12:01, Omar Abid <omar.abid2...@gmail.comwrote:
Hi,
I'm using a tree view to manage my tables.
The nodes are made dynamiclly, the problem that I want to create an
event when I select a node. I used the code below
treeview.selectednode.index = 0
but when I use that code the event run on all nodes and children nodes
I want to associate an index to each node to resolve that problem
Does any one had solution
Omar Abid
When a user clicks / selects a node the "AfterSelect" event fires. You
can then probe tree1.selectednodes to see what exactly was selected.

You can also create an OnMouseDown event for the tree and add the
line:

treMain.SelectedNode = treMain.GetNodeAt(e.X, e.Y)

And finally there is an event called "NodeMouseClick" which you can
use to signal something has been clicked and take the appropriate
action.

But it's hard for me to understand what your trying to do.

Jun 14 '07 #2
On 14 juin, 15:15, Phillip Ross Taylor <Phillip.Ross.Tay...@gmail.com>
wrote:
On 14 Jun, 12:01, Omar Abid <omar.abid2...@gmail.comwrote:
Hi,
I'm using a tree view to manage my tables.
The nodes are made dynamiclly, the problem that I want to create an
event when I select a node. I used the code below
treeview.selectednode.index = 0
but when I use that code the event run on all nodes and children nodes
I want to associate an index to each node to resolve that problem
Does any one had solution
Omar Abid

When a user clicks / selects a node the "AfterSelect" event fires. You
can then probe tree1.selectednodes to see what exactly was selected.

You can also create an OnMouseDown event for the tree and add the
line:

treMain.SelectedNode = treMain.GetNodeAt(e.X, e.Y)

And finally there is an event called "NodeMouseClick" which you can
use to signal something has been clicked and take the appropriate
action.

But it's hard for me to understand what your trying to do.
The problem is the node. I want to attribute to each note an index so
i can add to each node a special event
How to do that ?

Jun 14 '07 #3
Omar Abid wrote:
The problem is the node. I want to attribute to each node an index so
i can add to each node a special event
Why bother?

Derive your own TreeNode class and add instances of this to the TreeView.
In the Tree's AfterSelect event, test the Type of the node that was
clicked on and, if it's one of yours, invoke the required method.

Class CustomNode
Inherits TreeNode

Private Sub New()
End Sub

Public Sub New( ByVal sText As String )
MyBase.Text = sText
End Sub

Public Sub DoSomething()
End Sub

End Class

Dim node As New CustomNode( "Fred" )
treMain.Add(node)

Sub treMain_AfterSelect( ... ) _
Handles treMain.AfterSelect

If TypeOf e.Node Is CustomNode Then
With DirectCast(e.Node, CustomNode)
.DoSomething()
End With
End If

End Sub

HTH,
Phill W.
Jun 18 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tree menu using XML | last post by:
I have one XML file that has nodes and sub node and each and every node has the attribute call visible if its value is true then diplay this node else don't display thid node, but this condition i...
1
by: Jesper DK | last post by:
Hi, I have docked a tree view to the left on a form. When I start to populate this tree view with nodes, a horizontal scroll box appears in the bottom of the tree view even though thee tree...
1
by: Nick Warrington | last post by:
Hi all, I am having a small problem with a tree control I am playing with. I have created a custom tree view that displays nodes with a linktext control to the right of the nodes. When the...
3
by: Saradhi | last post by:
Hi All, Here I am facing a performance problem with the TreeView Node renaming. I am displaying a hierarchy Data in a treeview in my Windows C# Application. My tree view represents an...
1
by: Kaye | last post by:
It seems that when I dynamically resize items in a tree-view control, using TVM_SETITEM and the TVITEMEX iIntegral member, things go awry. The window draws properly, but it seems like the RECTs for...
10
by: dwok | last post by:
Does anyone know of a good article that discusses creating a "Tree View" control in ASP.NET? Or perhaps a Tree View Control that comes with source code? I have come across a lot of tree controls...
5
by: Pavan | last post by:
My goal is to accomplish the tooltip functionality for all the neodes in a tree view and i have the following three Events in my C# application. Name of my TreeView Control (AITreeView) 1)...
0
by: Santosh | last post by:
Asp.Net tree view control font problem Dear all i am downloading MS tree view control . i want to change the font size and font name of the tree view control i am wrtitting code for it like ...
4
by: contactme.navin | last post by:
Hi, I have problem in displaying the treeview in my asp pages. I had used the obout.com tree view to display the tree navigation in the webpages. Following is the error i got in the page....
3
by: gmail | last post by:
Hi Friends, Can any body suggest me on this. I am working on .NET 2005 Frame work 2.0 . I am facing problem using the tree stucture. I created the site map.Now i want use the site map in every...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.