473,508 Members | 3,235 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TreeView

Let say i have a bunch of files. Logfiles that is stored in subfolders.
Folder1
--logfile1
--logfile2
--logfile3
Folder2
--logfile1
--logfile2

I want to display these files using data from the files in an TreeView
control. Like this:

Folder1
--DATE1
----logfile1
----logfile2
--DATE2
----logfile3
Folder2
--DATE1
----logfile1
----logfile2

In other words i want to be able to sort the logfiles in a treeview control
using Folder->DATE->logfile.

As i see it i need to generate an object that contains data about the file.
These objects should be stored in an array within another object that is the
date. Dateobject is in an array within folder object.

This question is maybee simular to an previous one that i have asked in this
forum, but i dont regard this as an repost. I'm a newbee trying to learn
this language :-)

SO if you have any code samples or can point me to some it would help me a
lot.

Best regards
Nov 16 '05 #1
2 4525

The TreeView control does not support databinding, a techinque used to
display and edit data already stored in some datastructure.
Since you can't use databinding, you can create whatever structure you want.
It would make sence to use a structure that is easy to map over to a
hierarchical structure.

Each TreeNode that is added to the TreeView has a Nodes collection that
contains the sub-nodes for the next level. The exercise then becomes to add
each node into the right place, this depends entirely on what you want to
achieve, have a look at the MSDN samples for an idea of how to do it.

Another option is to use the TreeView as the data structure. This is only
advisable if you have a small program and don't have to view the same data
in multiple ways. Each TreeNode has a Tag property you can use to keep the
reference to the actual file. This reference can then be used for TreeView
context menus etc.

You can use the FileInfo object to get information about a file.
Chris

"Trond Hoiberg" <th******@broadpark.no> wrote in message
news:41******@news.broadpark.no...
Let say i have a bunch of files. Logfiles that is stored in subfolders.
Folder1
--logfile1
--logfile2
--logfile3
Folder2
--logfile1
--logfile2

I want to display these files using data from the files in an TreeView
control. Like this:

Folder1
--DATE1
----logfile1
----logfile2
--DATE2
----logfile3
Folder2
--DATE1
----logfile1
----logfile2

In other words i want to be able to sort the logfiles in a treeview
control using Folder->DATE->logfile.

As i see it i need to generate an object that contains data about the
file. These objects should be stored in an array within another object
that is the date. Dateobject is in an array within folder object.

This question is maybee simular to an previous one that i have asked in
this forum, but i dont regard this as an repost. I'm a newbee trying to
learn this language :-)

SO if you have any code samples or can point me to some it would help me a
lot.

Best regards

Nov 16 '05 #2
Thank you. I can not use FileInfo because i want to display data from inside
the file. That is why i want to make a class that is picking out data from
the file. One of those fields is a date/time (logging started). That filed
is it i want to display in the treeView control.

Folder
--DateFromInsideFile
---Logfile

That is why i have som trouble with this :-)
Best regards
Trond
"Christopher Kimbell" <c_*******@online.nospam> wrote in message
news:OV**************@TK2MSFTNGP12.phx.gbl...

The TreeView control does not support databinding, a techinque used to
display and edit data already stored in some datastructure.
Since you can't use databinding, you can create whatever structure you
want. It would make sence to use a structure that is easy to map over to a
hierarchical structure.

Each TreeNode that is added to the TreeView has a Nodes collection that
contains the sub-nodes for the next level. The exercise then becomes to
add each node into the right place, this depends entirely on what you want
to achieve, have a look at the MSDN samples for an idea of how to do it.

Another option is to use the TreeView as the data structure. This is only
advisable if you have a small program and don't have to view the same data
in multiple ways. Each TreeNode has a Tag property you can use to keep the
reference to the actual file. This reference can then be used for TreeView
context menus etc.

You can use the FileInfo object to get information about a file.
Chris

"Trond Hoiberg" <th******@broadpark.no> wrote in message
news:41******@news.broadpark.no...
Let say i have a bunch of files. Logfiles that is stored in subfolders.
Folder1
--logfile1
--logfile2
--logfile3
Folder2
--logfile1
--logfile2

I want to display these files using data from the files in an TreeView
control. Like this:

Folder1
--DATE1
----logfile1
----logfile2
--DATE2
----logfile3
Folder2
--DATE1
----logfile1
----logfile2

In other words i want to be able to sort the logfiles in a treeview
control using Folder->DATE->logfile.

As i see it i need to generate an object that contains data about the
file. These objects should be stored in an array within another object
that is the date. Dateobject is in an array within folder object.

This question is maybee simular to an previous one that i have asked in
this forum, but i dont regard this as an repost. I'm a newbee trying to
learn this language :-)

SO if you have any code samples or can point me to some it would help me
a lot.

Best regards


Nov 16 '05 #3

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

Similar topics

42
11470
by: lauren quantrell | last post by:
So many postings on not to use the treeview control, but nothing recently. Is it safe to swim there yet with Access 2000-Access 2003?
5
19868
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...
1
6663
by: paradox | last post by:
I want to have a TreeView that shows an image on some items, but not all. Basically, if a certain condition is true, a caution icon is placed next to the treeview item. The problem is that, by...
3
2817
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%""...
6
4913
by: L.M | last post by:
Hello, I knew how to use the treeview under VB6. After migrating to .NET, well, I'm lost. I try to add a new node, either to the same level or as a child to a selected node in the treeview....
14
15054
by: Mr.D | last post by:
How do I save/load the contents of a Treeview to a file? I have found several good examples written i VB6, but not a single one for VB.NET. Please help. ---- Tim
3
3802
by: christof | last post by:
I've got a really easy problem, please help me: There are two pages in one I'm creating a TreeView like that: TreeView dbTree = new TreeView(); TreeNode dbTreeRoot = new TreeNode("Root");...
2
7480
by: Tymbow | last post by:
I'm building a web application that is analogous to the Windows XP file explorer in function. The left column contains a TreeView, and the right column a DataGrid populated by selecting TreeView...
1
693
by: kvicky | last post by:
I am trying to load child nodes to a TreeNode in a TreeView in a ASP.net web application. The Treeview with parent nodes are loaded on a Page_load while doing if( ! ISPostback ) and then in the...
8
12727
by: Matt MacDonald | last post by:
Hi All, I have a form that displays hierarchical categories in a treeview. Ok so far so good. What I was to do is have users be able to select a node in the treeview as part of filling out the...
0
7228
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
7128
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7332
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
7393
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...
1
7058
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
7502
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...
0
4715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1565
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.