

"Provider=.12.0 Data Source=C:\Northwind 2007.accdb" As the below code shows we create a node and we add the wanted data to the created node in one go. Now it’s time to add some code enabling us to populate the TreeView control with the wanted data. We add two buttons to the Windows Form and manipulate them so they look like the following screen shot: For best performance change the ColorDepth for the list of images as the following screen shot shows: In other words, we will have three node levels root, tables and columns. Next, add three images to the ImageList which will differentiate the node levels from each other. Add a TreeView control to the Windows Form and also add an ImageList to the project. how to get tables and columns from a various type of databases.įirst of all we create a new Windows Form project in VB. In the final entry about the TreeView control a more generic approach will be discussed, i.e. In the next blog entry I will show how we can populate a TreeView control with data from a SQL Server database. To grab the names for all the tables as well as columns from a MS Access database can also be tricky but again I hope that the following case will clear the mud so to speak.Īt present I work with a new coming add-in that will include an advanced report generator and to work with tables and columns in a database plays a critical role in that tool. To work with TreeView controls can initially be tricky to understand but I hope the case here will make it more understandable. One common task is to let an application scan disks for folders and files and then populate a TreeView control with the data in a hierarchical way. In the following example all the tables and their columns from a MS Access database will be added to a Treeview control. Populating TreeViews controls with some data is a common task in various type of applications.
