472,110 Members | 2,105 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,110 software developers and data experts.

Need help with a TreeView

DJG
I need some help with a TreeView control in VB.Net

I've got a datatable with about 8000 rows. 500 are 'folders', and the
other 7500 rows are 'jobs'. It's a logical representation of some data,
and not a physical drive.

Each row has:
master_key (unique id)
folder_name (name for the user to see)
parent_key (the master_key of the parent folder)
other fields.....

The folder names are NOT unique.

I want to display a treeview, and allow the user to select a folder
where I will place a new 'job'.

I can figure out how to place all the nodes on the tree (I'm not sure if
I'm just going to display the folders, or each job yet). But I'm having
a hard time figuring out how to find out the unique folder that the user
selects.

Since it looks like TreeView nodes are all zero based indexes, and each
node starts over at zero, I can't figure out how to select the exact
folder to place the new job. I cannot use the master_key as the folder
name (it's 36 characters alphanumeric with no logic to the user), and I
can't insert it as any kind of index.

So it looks like I either have to:

1. Take the FullPath of the folder selected, and query my way backwards
through the table to figure out the master_key of the row the user
selected, or...

2. I saw something in HELP about how the TreeView could display
'objects' that tagged out to a name a user would understand. I'm not
real familiar with using objects that way (or any way really), but I
assume I would create a collection of custom objects that included both
the folder namd and the master_key. The folder name would be displayed
on the TreeView, while I could use the master_key selected for the rest
of my application.

Have I got this right? Or am I missing something really obvious here?

Thanks in advance for any help. P.S. - I'm new at this, so please talk
very s-l-o-w-l-y in your response ;-)

DJG

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
2 1463
VJ

"DJG" <an*******@devdex.com> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
I need some help with a TreeView control in VB.Net

I've got a datatable with about 8000 rows. 500 are 'folders', and the
other 7500 rows are 'jobs'. It's a logical representation of some data,
and not a physical drive.

Each row has:
master_key (unique id)
folder_name (name for the user to see)
parent_key (the master_key of the parent folder)
other fields.....

The folder names are NOT unique.

I want to display a treeview, and allow the user to select a folder
where I will place a new 'job'.

I can figure out how to place all the nodes on the tree (I'm not sure if
I'm just going to display the folders, or each job yet). But I'm having
a hard time figuring out how to find out the unique folder that the user
selects.

Since it looks like TreeView nodes are all zero based indexes, and each
node starts over at zero, I can't figure out how to select the exact
folder to place the new job. I cannot use the master_key as the folder
name (it's 36 characters alphanumeric with no logic to the user), and I
can't insert it as any kind of index.

So it looks like I either have to:

1. Take the FullPath of the folder selected, and query my way backwards
through the table to figure out the master_key of the row the user
selected, or...

2. I saw something in HELP about how the TreeView could display
'objects' that tagged out to a name a user would understand. I'm not
real familiar with using objects that way (or any way really), but I
assume I would create a collection of custom objects that included both
the folder namd and the master_key. The folder name would be displayed
on the TreeView, while I could use the master_key selected for the rest
of my application.

Have I got this right? Or am I missing something really obvious here?

Thanks in advance for any help. P.S. - I'm new at this, so please talk
very s-l-o-w-l-y in your response ;-)

DJG

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #2
VJ
I am assuming here you build the treeview from the datatable..when you do so
at the time of creation of your folders (or treenodes), you can specify a
unique tag for each node.. TreeNode.Tag is I believe the property. This
should make your folders unique even if they have the same text

VJ
"DJG" <an*******@devdex.com> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
I need some help with a TreeView control in VB.Net

I've got a datatable with about 8000 rows. 500 are 'folders', and the
other 7500 rows are 'jobs'. It's a logical representation of some data,
and not a physical drive.

Each row has:
master_key (unique id)
folder_name (name for the user to see)
parent_key (the master_key of the parent folder)
other fields.....

The folder names are NOT unique.

I want to display a treeview, and allow the user to select a folder
where I will place a new 'job'.

I can figure out how to place all the nodes on the tree (I'm not sure if
I'm just going to display the folders, or each job yet). But I'm having
a hard time figuring out how to find out the unique folder that the user
selects.

Since it looks like TreeView nodes are all zero based indexes, and each
node starts over at zero, I can't figure out how to select the exact
folder to place the new job. I cannot use the master_key as the folder
name (it's 36 characters alphanumeric with no logic to the user), and I
can't insert it as any kind of index.

So it looks like I either have to:

1. Take the FullPath of the folder selected, and query my way backwards
through the table to figure out the master_key of the row the user
selected, or...

2. I saw something in HELP about how the TreeView could display
'objects' that tagged out to a name a user would understand. I'm not
real familiar with using objects that way (or any way really), but I
assume I would create a collection of custom objects that included both
the folder namd and the master_key. The folder name would be displayed
on the TreeView, while I could use the master_key selected for the rest
of my application.

Have I got this right? Or am I missing something really obvious here?

Thanks in advance for any help. P.S. - I'm new at this, so please talk
very s-l-o-w-l-y in your response ;-)

DJG

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Bonj | last post: by
2 posts views Thread by Peter Flickinger | last post: by
1 post views Thread by Jigar Shah | last post: by
14 posts views Thread by Mr.D | last post: by
2 posts views Thread by engwar1 | last post: by

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.