VB.NET Access 2007 Hierarchical TreeView
|
visual Basic .Net project Hierarchical TreeView |
VB.NET Hierarchical TreeView Project requirements
- .Net FrameWork version 4.5 [Properties : Enable -> Make single instance application]
- Compile option -> Target CPU : x86
- MS Access 2007 / 2010 (*.accdb)
VB.NET Hierarchical TreeView Project logic
- Populate 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 Access 2007 and highlight search results.
- Perform Insert, Update, Search, Delete commands to/from Access 2007 Database from VS 2015 Form Control MenuStrip.
VB.NET Hierarchical TreeView Project steps summary
- Create Microsoft Visual Basic 2015 Project [Desktop Classic] Windows Form Application Project and name it [HierarchicalTreeView.vb], one Form (MainForm.vb).
- Create Access 2007 Database (hierarchical.accdb) in VS 2015 Project Directory (/Bin/Debug)
- Create Module (Connections.vb)
|
VB 2015 Hierarchical TreeView Project |
VB.NET Hierarchical TreeView Access 2007 Database Design
- Create three (3) tables [us_states],[us_cities],[BasicInfo]
|
VB 2015 Hierarchical TreeView Access 2007 2010 |
VB.NET Hierarchical TreeView Access 2007 Tables relationship
|
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]
- Validate OleDBConnection with Microsoft Access 2007 Database.
- 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.
- Populate TreeView Control with all Data from Microsoft Access 2007 Database table [BasicInfo] including Image, From [BackGroundWorker_RunWorkerCompleted] event.
- 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]
- 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].
The 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 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 Access table.
- How to populate [TreeView] Control on VB.NET Form with Data From MS Access 2007 table.
Source Code Download
Password : projectzone.co