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

Removing a SelectedNode from Treeview


Hi, I have a treeview, called Treeview1 with one father node and some
children nodes. Number of children nodes can change since every child node is
a file name that the user add through an Open DialogBox.

I'd like the user to be able to remove one or more children nodes by
selecting them. But if I use the following syntax:

Dim Mynode As TreeNode
Mynode = TreeView1.SelectedNode.Nodes(0)
Mynode.Remove()

the first child node is always removed, even if it's not selected while the
selected node stays where it was...where's my mistake?

thanks!!
Nov 21 '05 #1
5 7668
"Progalex" <Pr******@discussions.microsoft.com> schrieb:
Hi, I have a treeview, called Treeview1 with one father node and some
children nodes. Number of children nodes can change since every child node
is
a file name that the user add through an Open DialogBox.

I'd like the user to be able to remove one or more children nodes by
selecting them. But if I use the following syntax:

Dim Mynode As TreeNode
Mynode = TreeView1.SelectedNode.Nodes(0)
Mynode.Remove()


\\\
Me.TreeView1.SelectedNode.Remove()
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
The syntax:

Me.TreeView1.SelectedNode.Remove()

seems to work.

I used it without specifying "Me" and it seemed to remove the entire
structure of the treeview... very strange!

But thanks a lot!
Nov 21 '05 #3
The syntax:

Me.TreeView1.SelectedNode.Remove()

seems to work.

I used it without specifying "Me" and it seemed to remove the entire
structure of the treeview... very strange!

But thanks a lot!
Nov 21 '05 #4
"Progalex" <Pr******@discussions.microsoft.com> schrieb:
Me.TreeView1.SelectedNode.Remove()

seems to work.
Glad to hear that.
I used it without specifying "Me" and it seemed to remove the entire
structure of the treeview... very strange!


Mhm... This should not be the case...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #5
"Progalex" <Pr******@discussions.microsoft.com> schrieb:
Me.TreeView1.SelectedNode.Remove()

seems to work.
Glad to hear that.
I used it without specifying "Me" and it seemed to remove the entire
structure of the treeview... very strange!


Mhm... This should not be the case...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #6

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

Similar topics

4
by: David Elliott | last post by:
Hi, I have a Windows Explorer-like treeview that displays directories. After a cut/paste operation, I want the treeview to display the folder where the paste happened. But, I'm running into a...
1
by: jyoti ranjan | last post by:
i have a ie webcontrols treeview in my application. by default treeview is selecting the first node as selected index. i don't want a default selectednode. how can i get that one . can any body pls...
1
by: Progalex | last post by:
Hi, I have a treeview, called Treeview1 with one father node and some children nodes. Number of children nodes can change since every child node is a file name that the user add through an Open...
0
by: Bobby Owens | last post by:
Hi, I'm current having a problem with the treeview control and multi threading. The treeview is on a form. A request is then sent to a server using IP for the data. The data arrives in an event...
0
by: Jared | last post by:
I am using a TreeView with data stored in a database and have been trying to store a node index over a postback and re-select the node without using javascript. I couldn't find anything in these...
1
by: Dean Hinson | last post by:
Hello, I am trying to spawn a sunroutine in a worker thread for populating a trreeview. I set the selectednode and then start the thread. However, the thread errors because the selectednode was...
8
by: Jerry | last post by:
Hello, I am able to GET the selected node with my code. I would however like to SET any node with code. Something like me.treeview.selectednode="First" But this doesn't work. I can't find...
0
by: stacy | last post by:
My asp.net Web application is written in VB, using VS 2005 with Framework 2.0 I am having trouble with the SelectedNode element. The TreeView is built programmatically and looks like this: -...
0
by: bsturg21 | last post by:
Hello, I have an app that has a custom treeview which inherits the base treeview class and I am having a problem with the way the treeview is being redrawn. Each node in the treeview represents a...
1
by: Spam Catcher | last post by:
When I set the SelectedNode programmatically, how come the AfteSelect doesn't fire? Other controls (i.e. combobox) I believe do fire the SelectedIndexChanged when you programmatically update the...
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:
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.