winzip icon

DataTreeView

Email
Submitted on: 1/4/2015 5:38:00 AM
By: TLWallace (from psc cd)  
Level: Intermediate
User Rating: By 2 Users
Compatibility: VB.NET
Views: 1975
 
     Introduction At the time of this writing, the standard Windows Forms .NET TreeView control doesn't support the concept of databinding like the ASP.NET TreeView control. So, we are left writing our own solutions. This solution provides a standardized way to use databinding with the Windows Forms .NET TreeView control. This functionality will enable you to quickly develop user-friendly ways to create and view complex data information. It includes the Databinding as well as the following Design Patterns: Facade, Proxy, Singleton. It also includes custom 'Rule' classes to give the developer at design time the ability to derive primary key and foreign key data points. This is essential to adjusting the underlying Dataset when changes to the TreeView occur. Updates are also performed on a Asynchronous separate thread. The last item I'd like to mention is that this class does support two table DataSets, a Primary key table and a Foreign key table. Requirements The following were the initial requirements: Databind a DataSet to the TreeView and save results back to a Microsoft Access database. Design the solution to make it easy to reuse the class in different solutions. Encapsulate as much of the binding logic inside the custom solution and hide it from the UI developers. UI developers should have to write next to nothing for code to keep the TreeView in sync with the DataSet underneath it. Provide a sample for deleting nodes in the TreeView (via right click context menu) and have that deletion automatically reflected in the DataSet. Provide a sample for editing nodes in the TreeView (via right click context menu) and have the .Text property change automatically reflected in the DataSet. Provide a sample for inserting nodes in the TreeView (via right click context menu) and have the new node automatically reflected in the DataSet. Support drag and drop of TreeNode branches within the same TreeView and have the relationships automatically reflected in the DataSet. If the following columns are in the DataTable: Checked, ForeColor, BackColor, ImageIndex, or SelectedImageIndex, incorporate the following node properties when the TreeNode is created. If the any of these columns are missing, simply implement the default value for the TreeNode. Support drag and drop of TreeNode branches across multiple TreeView controls and have the relationships automatically reflected in the target DataSet as well as the source DataSet. Provide a sample for accepting and rejecting changes made to the same TreeView control giving the user the ability to undo their changes. Automatically commit changes to the source and target DataSet when a TreeNode branch is dropped on the target TreeView.

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com


Other 2 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.