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

nodes and data in a treeview

I need a way to give each node an id number onto of what the text is being
displayed so i can access data in a database... how would i do this? this is
an example

RootNode (data: root)
+ Child1 (data: ID000001)
+ Child2 (data: ID000002)
+---ChildOfChild1 (data: ID0000003)

I thought tags would work by giving a structured data type as the object,
but i cant seem to figure out how to convert the tag back into the data...
any help or ideas would be real nice, thanks!
Nov 20 '05 #1
5 1436
Cor
Hi Brian,

A XML file is not always a relational database, it passes it in its
possibilities.

Therefore it is not always possible to put a XML file in a database.

On the other hand can every so called relational database be put in a XML
file.

I hope this helps?

Cor
I need a way to give each node an id number onto of what the text is being
displayed so i can access data in a database... how would i do this? this is an example

RootNode (data: root)
+ Child1 (data: ID000001)
+ Child2 (data: ID000002)
+---ChildOfChild1 (data: ID0000003)

I thought tags would work by giving a structured data type as the object,
but i cant seem to figure out how to convert the tag back into the data...
any help or ideas would be real nice, thanks!

Nov 20 '05 #2
I could be totally wrong here, but I think he's not talking about XML. Just
an ordinary treeview.

When adding do something like this :
int id = 5;
TreeNode node = new TreeNode("Data ID" + id);
node.Tag = id;
treeview1.Nodes.Add(node);

Then when you need it just simply convert it :
int number = (int) treeview1.SelectedNode.Tag;

If the leading 0s are important you can use a string in stead of an int.

Yves

"Cor" <no*@non.com> schreef in bericht
news:%2******************@TK2MSFTNGP10.phx.gbl...
Hi Brian,

A XML file is not always a relational database, it passes it in its
possibilities.

Therefore it is not always possible to put a XML file in a database.

On the other hand can every so called relational database be put in a XML
file.

I hope this helps?

Cor
I need a way to give each node an id number onto of what the text is being displayed so i can access data in a database... how would i do this? this
is
an example

RootNode (data: root)
+ Child1 (data: ID000001)
+ Child2 (data: ID000002)
+---ChildOfChild1 (data: ID0000003)

I thought tags would work by giving a structured data type as the

object, but i cant seem to figure out how to convert the tag back into the data... any help or ideas would be real nice, thanks!


Nov 20 '05 #3
Cor
Hi Phoenix.

Thanks for your attention, I did not look good to the subject.

Sorry Brian

Cor
I could be totally wrong here, but I think he's not talking about XML. Just an ordinary treeview.

Nov 20 '05 #4
Cor
Hi Brian,

Phoenix(Yves) his sample is correct, but it is in C#

I made one in VB.net to correct my mistake

I hope this helps?

Cor

\\\Needs a treeview on a form
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
TreeView1.BeginUpdate()
TreeView1.Nodes.Clear()
For i As Integer = 0 To 100
TreeView1.Nodes.Add(New TreeNode(i.ToString))
For y As Integer = 0 To 10
TreeView1.Nodes(i).Nodes.Add(Chr(y + 65))
TreeView1.Nodes(i).Nodes(y).Tag = i.ToString & Chr(y + 65)
Next
Next
TreeView1.EndUpdate()
End Sub
Private Sub TreeView1_AfterSelect(ByVal sender _
As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles
TreeView1.AfterSelect
If Not TreeView1.SelectedNode.Tag Is Nothing Then
MessageBox.Show(TreeView1.SelectedNode.Tag.ToStrin g)
End If
End Sub
///

I need a way to give each node an id number onto of what the text is being
displayed so i can access data in a database... how would i do this? this is an example

RootNode (data: root)
+ Child1 (data: ID000001)
+ Child2 (data: ID000002)
+---ChildOfChild1 (data: ID0000003)

Nov 20 '05 #5
yep not an XML file ;) I have a SQL Server backend hehe... but thanks for
the treeview info both of you.
"Cor" <no*@non.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Hi Brian,

A XML file is not always a relational database, it passes it in its
possibilities.

Therefore it is not always possible to put a XML file in a database.

On the other hand can every so called relational database be put in a XML
file.

I hope this helps?

Cor
I need a way to give each node an id number onto of what the text is being displayed so i can access data in a database... how would i do this? this
is
an example

RootNode (data: root)
+ Child1 (data: ID000001)
+ Child2 (data: ID000002)
+---ChildOfChild1 (data: ID0000003)

I thought tags would work by giving a structured data type as the

object, but i cant seem to figure out how to convert the tag back into the data... any help or ideas would be real nice, thanks!


Nov 20 '05 #6

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

Similar topics

3
by: serge calderara | last post by:
Dear all, I have a csv file data which has been read and populate on a dataset object. then I need to bind part of the content of the dataset to a treeview control. I have read that XML format...
4
by: alanrn | last post by:
I am using a TreeView to display the hierarchy of a strongly-typed collection (inherited from CollectionBase). The order of the nodes in the TreeView is strictly tied to the order in which they...
4
by: JoKur | last post by:
I'm currently using a context menu to allow the user to add, rename and delete nodes in a treeview control. When a node is added we give it a bogus name ("NewNode") and invoke the add method. We...
0
by: stardust | last post by:
Hi everyone, Within a Winform application, a treeview is contained in a User Control and the User Control is then located within a splitview. When the UserControl added some nodes into the...
3
by: juvi | last post by:
Hi, I have got a problem with Treeview.Nodes.Clear() under VB2005. When I have some nodes in my treeview and a force to clear() all nodes then it seems to work, because the nodes are not visible....
2
by: Kristopher Wragg | last post by:
I'm having some serious problems with the TreeView control. I've got a control that inherits TreeView and has some methods that firstly create a TreeNode then does some recursive procedure to add...
0
by: drop | last post by:
Hi, I'm currently working with the Treeview control in ASP .Net 2.0. The tree is filled dynamically based on data contained in a MySQL Database. Here is the exact behavior I want : 1 - User...
10
by: John Rogers | last post by:
This code only counts the parent nodes or rootnodes in a treeview, how do you count all the nodes in a treeview? // one way int NodeCounter = 0; foreach (TreeNode currentNode in...
6
Sl1ver
by: Sl1ver | last post by:
I've got a problem, i got the nodes to move but 1. they copy nodes(if you drag it to 3 different places it will actually have 3 of the same nodes) 2. i want to make the nodes, if moved update the...
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: 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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.