473,396 Members | 1,707 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.

Treeview Control

Is it me or has the VB.NET Treeview control gone back to the darkages.

I am trying to update a VB6 programme that uses the treeview control a lot- there are 4 treeview controls which are constantly being altered by user input.
On upgrading the treeview errors are too numerous to list all of them.

What has happened to 'Treeview1.nodes.add (ParentNode, Relation, NodeKey, Text)'? and Treeview1.nodes(NodeKey)

Why is there no Node.Key?

My VB6 programme relies on the Node.Key to access a node and alter texts and keep track of what the children of a parent node are.
Can someone enlighten me please.
Nov 20 '05 #1
5 5682
Its silly, but you can maintain your own hash to keys for the tree view.
ie. whenever you add a node, you add a hash to the item into a hashtable -
then, fetching the node from its key is just a case of asking the hashtable
for it. As to why this is the case, I have no idea ;)
"JamesT" <ji*********@ampekko.com> wrote in message
news:AE**********************************@microsof t.com...
Is it me or has the VB.NET Treeview control gone back to the darkages.

I am trying to update a VB6 programme that uses the treeview control a lot- there are 4 treeview controls which are constantly being altered by
user input. On upgrading the treeview errors are too numerous to list all of them.

What has happened to 'Treeview1.nodes.add (ParentNode, Relation, NodeKey, Text)'? and Treeview1.nodes(NodeKey)
Why is there no Node.Key?

My VB6 programme relies on the Node.Key to access a node and alter texts and keep track of what the children of a parent node are.

Can someone enlighten me please.

Nov 20 '05 #2
"JamesT" <ji*********@ampekko.com> schrieb
Is it me or has the VB.NET Treeview control gone back to the
darkages.

I am trying to update a VB6 programme that uses the treeview control
a lot- there are 4 treeview controls which are constantly being
altered by user input. On upgrading the treeview errors are too
numerous to list all of them.

What has happened to 'Treeview1.nodes.add (ParentNode, Relation,
NodeKey, Text)'? and Treeview1.nodes(NodeKey)

Why is there no Node.Key?
Hmmmm....
My VB6 programme relies on the Node.Key to access a node and alter
texts and keep track of what the children of a parent node are.


Additionally add the nodes to a Hashtable. You can access them by the key.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
Hi Jim,

First of all, I would like to confirm my understanding of your issue.

From your description, I understand that you wants to use key property in
VB.NET treeview just as the vb6 treeview do.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

The version of the TreeView control that is included with Visual Studio
..NET has no equivalent Key property so far.
Here is an KB article you may take a look.
HOW TO: Create a Key Property for a TreeView Node in Visual Basic .NET
http://support.microsoft.com/default...b;en-us;311318

Also as Robin said, you can add all the nodes to a 'Hashtable' by using a
unique name as key.
Then you can access the nodes by key easily.

Please apply my suggestion above and let me know if it helps resolve your
problem.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #4
Peter

Sorry for delay in replying

What you suggest does seem to cure the problem of no KEY, but I still have a problem of adding a child node to a parent node easily
I drag a listviewItem to the TreeView, over either a child node or the parent node, and then add the item, as a child, to the parent, checking first to see if the node already exists and then changing the text to have a count at the end. Also being able to drag a child from one parent to another(cruel I know

example:(in plainish VB6/English
(Drag a ListViewItem on to TreeView
pNode = GetParentNode(of node where Item dropped) ' get parent node if child, or node if paren
' the same item can exist in different parents with th
' parent key being added to the child ke
if NodeExist(ListViewItem.Key) then 'returns boolean if node already present within the parent nod
nodekey=ListViewItem.key ' ensures nodekey = listitemke
NCount= right(Node(NodeKey).text,3) ' update counter at end of tex
Node(NodeKey).text=left(node(NodeKey).text,len(nod e(NodeKey).text)-3 & format(NCount,"000") ' change tex
els

dim nNode as new node ' new nod
nNode.text= ListviewItem( & ":001" (Or TreeviewItem text) ' Set tex
nNode.key=listViewItem.key (or TreeView.Node.key) ' set Ke
pNode.nodes.add nnode ' add nod
end i

The above works well if KEYS are used but I seem to have a mental block in VB.NET.
you can see why I have a dependence on KEYS

I see that in VS 2005 the KEY is back. perhaps the ADD(parent node,relation,key,text) will reappear as well. Microsoft please note!!!

I may decide to switch to VS 2005 to rewrite my programme, it will take some time as there are a lot of new features I want to add to it, and hope that a better version than the March Preview becomes available soon

James

Nov 20 '05 #5
Hi James,

Yes, this is a limitation in the treeview control shipped with VS.NET 2003
so far. And in the next the feature(key) should be back, but I can not
guarantee the behavior before the VS.NET 2005 is released officially.

So far we can only to workaround the problem as I said in my last post.

If you still have any concern on this issue, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #6

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

Similar topics

5
by: SoKool | last post by:
Can anyone point me to a site where I can get a free treeview control to use in ASP .NET or any tutorial that can help me build my own treeview control. I intend to use a treeview to generate a...
8
by: Hrvoje Voda | last post by:
What is wrong in this code? private void tree_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.Enter ) {
3
by: Peter | last post by:
Hello, We are inserting a side menu to our application using a class that is writing HTML on all our pages. This is a part of the code as an example: writer.Write(" <table WIDTH=""100%""...
4
by: Ben Coats | last post by:
Hey, I'm trying to find code for an Explorer-style Directory ComboBox. (You know, it display "Desktop", "My Computer", all drives, etc., but it has a treeview control inside the combobox so that...
10
by: p3t3r | last post by:
I have a treeview sourced from a SiteMap. I want to use 2 different CSS styles for the root level nodes. The topmost root node should not have a top border, all the other root nodes should have a...
1
by: musosdev | last post by:
Hi guys I was using the Microsoft.Web.UI.WebControls extra namespace in my application to provide me with a TreeView control. I was using specifically ..GetNodeFromIndex(), SelectedNodeIndex and...
2
by: rolf.oltmans | last post by:
Hello all, I need to place treeview control in Grid control. I need to place it in a grid because I need to show calendar against every node. Is placing a treeview in grid possible? If I need...
1
by: doemon | last post by:
Hi, I'm working on a pagination control and I need to dynamically rerender a treeview to display the next set of nodes depending on which page we're on. For example, page 1 will dispaly only...
0
by: noneya22 | last post by:
I want to use a TreeView control as a one-level, vertical navigation menu. I'm using this control currently with a SiteMapDataSource and .sitemap file. I've written code that associates an image...
0
by: jiing | last post by:
Hi all, I want to use sting(the same as Node.Text) to judge if a node exists in TreeView. I've tried several ways, but seems all failed. could anybody help me? Thanks in advance. //My...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.