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

Need help with a TreeView

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


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

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