By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,639 Members | 1,326 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,639 IT Pros & Developers. It's quick & easy.

nodes and data in a treeview

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.