Welcome to ADO.NET Access 2003—your ultimate hub for VB.NET and ADO.NET programming excellence. Discover in-depth tutorials, practical code samples, and expert troubleshooting guides covering a broad range of topics—from building robust WinForms applications and seamless MS Access integration to working with SQL Server, MySQL, and advanced tools like WebView2 and Crystal Reports. Whether you're a beginner or a seasoned developer, our step-by-step articles are designed to empower you to optimize.

Looking for MS Access Developer❓❓

Application developer

Post Page Advertisement [Top]

VB.NET MS Access 2007 
Hierarchical TreeView

vb.net Hierarchical TreeView
visual Basic .Net project Hierarchical TreeView

VB.NET Hierarchical TreeView Project requirements

  • VS2010 / VS2015 / VS2022
  • .NET Framework4.5 [Properties : Enable -> Make single instance application]
  • Compile option -> Target CPU : x86
  • MS Access 2007 / 2010 (*.accdb)

VB.NET Hierarchical TreeView Project logic

  • Populate MS Access 2007 Database Tables with Data from Visual Basic 2015 Form Controls [TextBox]
  • Display or populate TreeView control with Hierarchical Data From Microsoft Access 2007 Database (*.accdb)
  • Display or populate TreeView control (Parents / Child) with search results from MS Access 2007 Database and highlight search results.
  • Perform CRUD operation (Create, Read, Update and Delete) on MS Access 2007 Database from VS2015 Form MenuStrip Control.

VB.NET Hierarchical TreeView Project steps summary

  1. Create Microsoft Visual Basic 2015 Project [Desktop Classic] Windows Form Application Project and name it [HierarchicalTreeView.vb], one Form (MainForm.vb).
  2. Create MS Access 2007 Database (hierarchical.accdb) in VS2015 Project Directory (/Bin/Debug)
  3. Create new Module (Connections.vb)

vb.net Hierarchical TreeView tutorial
VB 2015 Hierarchical TreeView Project

VB.NET Hierarchical TreeView Access 2007 Database Design

  • Create three (3) tables [us_states],[us_cities],[BasicInfo]

vb.net Hierarchical TreeView tutorial
VB 2015 Hierarchical TreeView Access 2007 2010


VB.NET Hierarchical TreeView Access 2007 Tables relationship


vb.net Hierarchical TreeView tutorial
VB 2015 Hierarchical TreeView with MS Access Table Relation

VB.NET Hierarchical TreeView Project Functionalities

MainForm

Is linked to MS Access Database 2007 hierarchical.accdb programatically. MainForm form performs Save, Search, Edit, Delete, Display to TreeView Control all Data From/Into Database Tables programmatically.

Form_Load event

  1. Validate OleDBConnection with Microsoft Access 2007 Database.
  2. Populate ComboBox with Data from Microsoft Access 2007 Database table [us_cities] contains 29.8k records which are all United States Cities and all the States are from table [us_states] From [BackGroundWorker_RunWorkerCompleted] event.
  3. Populate TreeView Control with all Data from Microsoft Access 2007 Database table [BasicInfo] including Image, From [BackGroundWorker_RunWorkerCompleted] event.
  4. Triggers BackgroundWorker.RunWorkerAsync() and BackgroundWorker_DoWork() that executes all the ComboBox and TreeView Controls populations and displays both contents on MainForm after finishing their job.

TreeView Mouse_DoubleClick() event

Displays all Database table contents that is stored in the TreeView Control nodes on the Form's controls.

BackGroundWorker

Displays the Form and all controls while waiting for ComboBox control to load 29.8k records from Access 2007 table us_cities and also the TreeView Control to load all Data stored in the Access 2007 table BasicInfo.

MS Access 2007 Database [hierarchical.accdb

has all United States States in table us_states, each United State's STATE_NAME in table us_states is linked to its Cities in table us_cities
Table BasicInfo is linked to table us_cities, so each User in table BasicInfo is linked to us_cities on field ID as shown above.

MenuStrip [File]

  • [New] : Clears all TextBoxes and resets the TreeView Control ForeColor and BackColor.
  • [Save] : Performs Sql Statement [Insert Into] using [OleDBTransaction] after validating all controls.
  • [Search] : Searches TreeView Control and Highlights search results nodes ForeColor and BackColor.
  • [Update] : Performs Sql Statement [Update table Set ..] and displays result on TreeView and Form.
  • [Delete] : Performs Sql Statement [Delete From table ..] and displays result on TreeView Control and on form.
  • [Compact & Repair] : Reduces/compacts Microsoft Access 2007 Database file size and do Repairs, using Microsoft.Office.Interop.Access.Dao.DBEngine [version 12.0.0.0 for Access 2007] [version 14.0.0.0 for Access 2010].

VB.NET Hierarchical TreeView Project MainForm Design

vb.net Hierarchical TreeView tutorial
VB.NET Hierarchical TreeView Project MainForm Design

In this VB.NET project example you will learn

  • Connecting MS Access 2007 Database [*.accdb] password protected to VB.NET Form programmatically using [Module].
  • Executing SQL Statements [Insert InTo, Update, Select, Delete, Select ... INNER JOIN] on Access 2007 table using VB.NET OleDB Parameters.
  • How to populate [ComboBox] Control with Data from Access 2007 Database Table using Dictionary(Of String, String)() method.
  • How to use VB.NET [BackgroundWorker] Control to display UI (MainForm) while waiting to fill ComboBox with Data from Access 2007 Database table.
  • How to show [Progressbar] Control loading action while Data from Database table is being loaded into ComboBox Control.
  • How to insert Photo/Image from [PictureBox] Control into Access 2007 table and retrieve Photo/Image from Access 2007 table to VB.NET [PictureBox] Control.
  • How to insert Custom Date Format from [DateTimePicker] Control into Access 2007 table and retrieve Date from Access 2007 table to VB.NET [DateTimePicker] Control with Custom Format.
  • How to populate [ImageList] with Images from Access 2007 Database table and use Images from VB.NET ImageList Control into TreeView Control.
  • Populate VB.NET TreeView Control with photos/images from Access 2007 table using Imagelist Keys.
  • How to use OleDBTransaction with Sql Statement Insert Into and Sql Statement Update to ensure Data were successfully inserted into MS Access Database table.
  • How to populate TreeView Control on VB.NET Form with Data From MS Access 2007 table.

Source Code

Password : projectzone.co

 Here are some online Visual Basic lessons and courses:

Bottom Ad [Post Page]