473,320 Members | 1,904 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,320 software developers and data experts.

Fill treeView from DataTable

Hello Group,

I have DataTable dt with 3 Columns (id, GroupName, ItemName).
How group in TreeView items by GroupName?

EX:
myTable:
id GroupName ItemName
1 Group1 it1_gr1
2 Group2 it1_gr2
3 Group1 it2_gr1
4 group1 it3_gr1
5 group2 it2_gr2

and treeview
Root
- Group1
- - it1_gr1
- - it2_gr1
- - it3_gr1
- Group2
- - it1_gr2
- - it1_gr2
Thx for yours Help

br.
PawelR
Aug 7 '06 #1
2 11625
PawelR,

You will have to do this manually, there is no way to bind to a tree
view in this manner out of the box.

Basically, you will have to cycle through the items, adding the groups
to the tree as you come across new ones. If the group already exists, then
you have to populate the node that represents the group, instead of adding
it to the root.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"PawelR" <p@p.pwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Hello Group,

I have DataTable dt with 3 Columns (id, GroupName, ItemName).
How group in TreeView items by GroupName?

EX:
myTable:
id GroupName ItemName
1 Group1 it1_gr1
2 Group2 it1_gr2
3 Group1 it2_gr1
4 group1 it3_gr1
5 group2 it2_gr2

and treeview
Root
- Group1
- - it1_gr1
- - it2_gr1
- - it3_gr1
- Group2
- - it1_gr2
- - it1_gr2
Thx for yours Help

br.
PawelR


Aug 7 '06 #2
Thanks
for your help.
I do it manually.

PawelR
Użytkownik "Nicholas Paldino [.NET/C# MVP]"
<mv*@spam.guard.caspershouse.comnapisał w wiadomo¶ci
news:ed**************@TK2MSFTNGP02.phx.gbl...
PawelR,

You will have to do this manually, there is no way to bind to a tree
view in this manner out of the box.

Basically, you will have to cycle through the items, adding the groups
to the tree as you come across new ones. If the group already exists,
then you have to populate the node that represents the group, instead of
adding it to the root.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"PawelR" <p@p.pwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>Hello Group,

I have DataTable dt with 3 Columns (id, GroupName, ItemName).
How group in TreeView items by GroupName?

EX:
myTable:
id GroupName ItemName
1 Group1 it1_gr1
2 Group2 it1_gr2
3 Group1 it2_gr1
4 group1 it3_gr1
5 group2 it2_gr2

and treeview
Root
- Group1
- - it1_gr1
- - it2_gr1
- - it3_gr1
- Group2
- - it1_gr2
- - it1_gr2
Thx for yours Help

br.
PawelR



Aug 8 '06 #3

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

Similar topics

5
by: Mark Goldin | last post by:
Anybody can shart some working samples of using that control on Windows form? Thanks
4
by: Ian Powell | last post by:
Hi I've got objects in an sorted ArrayList like: P:\ P:\\DOCS P:\\i386 P:\\i386\ASMS P:\\i386\ASMS\1000 P:\\i386\ASMS\1000\MSFT
0
by: Seiche V via DotNetMonster.com | last post by:
hy. i want to fill a data table from a dataset using SqlDataAdapter.fill(myTable), but i get the error: System.NullReferenceException: Object reference not set to an instance of an object. ...
2
by: DJG | last post by:
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,...
0
by: Henry | last post by:
I am trying to create a TreeView control that works with an ADO Dataset DataTable or the new BindingSource stuff in .NET 2.0 to build a Treeview that is populated. This is what I came up with...
10
by: dauphian | last post by:
Hello, I am new to .net and am trying to build a report application that queries 4 different tables based on a id, and I need to return them in the same table for easy viewing. Basically, I...
4
by: Henry | last post by:
Does anybody have a real-world sample of buiding a treeview control using data from database tables? All the sample code I have found either builds the treeview manually or uses a file directory...
2
by: Adrien Reboisson | last post by:
I'm trying to build a basic DB explorer using C# & Visual Studio 2005. I installed SQL Server 2005 Express, created a blank project, dropped a TreeView, a ListView and a DataGridView : DB objects...
1
by: dotnetnari | last post by:
hi, How to Drag and drop the nodes from treeview into datatable columns using windowsapplication in c# Thanks
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.