Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TreeView with Hierarchical DataSet Design Question

Status
Not open for further replies.

dougcoulter

Programmer
Joined
Mar 16, 2001
Messages
112
Location
US
Hello all. I am working on a project for displaying and managing a modest inventory. The inventory data is located in an MSDE database and I would like to work with the TreeView as the primary control. The data is stored in five (5) hierarchical tables. I start with a root table, which is then related to a child table which is then related to another child table, etc. It is essentially the same as a Windows Explorer hierarchy (which is why I like the idea of the TreeView), except instead of files, I am primarily dealing with parts.

I have currently set up 5 DataAdapters (1 for each table), which are used to fill a single DataSet. I am currently populating the contents of the TreeView in a just in time fashion (i.e.: filling a parameterized query DataAdapter based on the expanded TreeView node). The DataTables in my DataSet are also only populated based on what node is selected. I am wondering if this is the best way to go, or should I just FULLY populate the DataSet (all parts in the inventory) initially and allow for a manual refresh. If I do FULLY populate the DataSet, should I also FULLY populate the TreeView as well? As an example, let's say we are talking a total of 3500 records (spread across the 5 tables). I want to make it as easy on myself as possible when it comes to enabling data manipulations (adding, editing and deleting records), which will have to be updated back through the DataAdapter(s).

I hope this makes sense. Thanks...
 

I have written something similar in VB6.0SP5 and I can say that if you try to populate the entire dataset at one go it will take awhile for your form/treeview to be loaded causing the user to wait and possibly making your program look like it is not responding. The way that I did it was to use progress bar to show the user that the form was loading the top level and as necessary the next level (to show plus signs for sub items). On the expansion of the top level I then search for any child items for the child item. Meaning...
[tt]
+ Parent Item (Loaded)
+/- Child Item (Loaded when Parent Item was loaded)
?/+/- This item was searched for when parent item was expanded and added if found.
[/tt]

I hope this makes sense since .net is a little bit different than vb.

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top