473,320 Members | 2,164 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,320 software developers and data experts.

TreeView and TreeNodes

My first time using a TreeView:

I've got a TreeView that I populated with some data and it has nodes.

In the Properties window, I created an Event Handler for the TreeView's
AfterSelect method, and it allows me to determine what Tree Node has been
selected.

However, if I expand the TreeView and select one of the Child TreeNodes,
they do not trigger this event.

My local help says to use the SelectedNodeChanged Event, but I do not see
that in the Properties window.

How is the best way to handle whenever an item in my TreeView is selected
(including the TreeView TreeNodes)?

Thanks,
Joe

Jul 8 '08 #1
2 2166
On Jul 9, 1:17 am, jp2msft <jp2m...@discussions.microsoft.comwrote:
My first time using a TreeView:

I've got a TreeView that I populated with some data and it has nodes.

In the Properties window, I created an Event Handler for the TreeView's
AfterSelect method, and it allows me to determine what Tree Node has been
selected.

However, if I expand the TreeView and select one of the Child TreeNodes,
they do not trigger this event.

My local help says to use the SelectedNodeChanged Event, but I do not see
that in the Properties window.

How is the best way to handle whenever an item in my TreeView is selected
(including the TreeView TreeNodes)?

Thanks,
Joe
As i understood, you created an AfterSelect event for TreeView
control, i couldn't reproduce the problem about triggering AfterSelect
event, here it is:

Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal
e As System.Windows.Forms.TreeViewEventArgs) Handles
TreeView1.AfterSelect
MsgBox("worked!")
End Sub

..which works even when a root or child node is selected.

Plus, there's no an event called "SelectedNodeChanged" for TreeView as
i'm using .NET 2.0 for "Winforms", based on my search it's available
for ASP.NET web controls and though i referenced System.Web.dll and
imported "System.Web.UI.WebControls" still i'm unable to get
"SelectedNodeChanged" event maybe due to using VB 2005 express instead
of Visual Web Developer.

Plus, you can check this out for usage:
http://msdn.microsoft.com/en-us/libr...dechanged.aspx

Hope this helps,

Onur Güzel
Jul 9 '08 #2
Interesting. You are right! It is working today.

Perhaps I had a bug in the system yesterday. Sorry for the confusion.

"kimiraikkonen" wrote:
As i understood, you created an AfterSelect event for TreeView
control, i couldn't reproduce the problem about triggering AfterSelect
event, here it is:

Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal
e As System.Windows.Forms.TreeViewEventArgs) Handles
TreeView1.AfterSelect
MsgBox("worked!")
End Sub

..which works even when a root or child node is selected.

Plus, there's no an event called "SelectedNodeChanged" for TreeView as
i'm using .NET 2.0 for "Winforms", based on my search it's available
for ASP.NET web controls and though i referenced System.Web.dll and
imported "System.Web.UI.WebControls" still i'm unable to get
"SelectedNodeChanged" event maybe due to using VB 2005 express instead
of Visual Web Developer.

Plus, you can check this out for usage:
http://msdn.microsoft.com/en-us/libr...dechanged.aspx

Hope this helps,

Onur Güzel
Jul 10 '08 #3

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

Similar topics

2
by: Sean | last post by:
Hi all, I have a treeview and because I subclass the treeview and allow multiple selection to be done on the treeview, I have a problem changing the background color of the treeview. The...
1
by: David Elliott | last post by:
I am trying to use the TreeView Control that is part of the WebControls package from Microsoft. I was getting this error: Exception Details: System.Xml.XmlException: The data at the root level...
0
by: claireCSHARPuser | last post by:
Hi I'm having a problem with a tree view. The data source for this an XML string set using the TreeView.TreeNodeSrc property in the code behind page. The XML is generated by a stored procedure...
14
by: Evan Kontos | last post by:
I am trying to implement a Treeview w/an XML file and I even copied and pasted examples from MSDN but can't get them to work. Any suggestions welcome. XML File <TREENODES> <TREENODE...
1
by: | last post by:
What's the best way to create new nodes on a treeview 2.0 and save them to an xml file? Thanks, Victor
8
by: Matt MacDonald | last post by:
Hi All, I have a form that displays hierarchical categories in a treeview. Ok so far so good. What I was to do is have users be able to select a node in the treeview as part of filling out the...
8
by: sfauchille | last post by:
Hello, I have to fill a treeview with data in a text file text file A.B.C.D.Var1 A.B.C.D.var2 A.B.A.Var1 B.A.C.var2 B.C.D.var3
1
by: =?Utf-8?B?TWFya3VzIFNjaC4=?= | last post by:
Hello, i'm seeking for a Favorites and Shortcut image for a TreeView Control. (The Shortcut image should be combined with the object image with DrawImageUnscaled) They should look like in...
12
by: minimalniemand | last post by:
I try to recursivley fill a treeview from a xml-file. It works well, when the contents of the xml and the treeview match 1:1. code here: http://mad-scientists.co.uk/micha/shownode.txt a sample...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.