1. Technology

Your suggestion is on its way!

An email with a link to:

http://delphi.about.com/od/vclusing/l/aa060603a.htm

was emailed to:

Thanks for sharing About.com with others!

A TreeView of Data
How to display a dataset of records from a table/query in a treeview component.
 Win prizes by sharing code!
Do you have some Delphi code you want to share? Are you interested in winning a prize for your work?
Delphi Programming Quickies Contest
 Join the Discussion
"Post your views, comments, questions and doubts to this article."
Discuss!
 Related Resources
• Using VCL components
• Using DB components
• Drag and drop in Delphi

Article submitted by: Anand Gopalakrishnan for the Delphi Programming Quickies Contest.

   A TreeView of data
A treeview of Data

This sample project uses one Page control, 3 TabSheets, 2 Combo Boxes, a BitBtn, Splitter, Memo, Listbox, Dbgrid and 2 Treeviews.

Usage of tabsheets on the pagecontrol:
- General Used for Structure Definition from a fields in the table.
- Data view displays the treeview with records in a hierarchial order.
- Grid View displays query result in a grid.

General tabsheet has the following treeview for structure definition which forms the base. Two ComboBoxes each for selecting the alias and table; as soon as they are selected, the fields of the selected table are displayed in the list box.

Dragging can be done from the list box on to the treeview for structure definition. Thats all! After the structure is defined just click the "view data" button. Query statement is displayed in the memo just below the tree view. Switching tab sheets will show you the data view. Treeview items containing the record values filled from the table and then the grid view display of records in a DBGrid.

Delphi's DB treeview

Download Full source code!

Of course, if you have any question please post and discuss on the Delphi Programming Forum

See More About
Related Video
Using Meta Data for Search
Export Data From an Excel Sheet to a Word Document

©2014 About.com. All rights reserved.