C# – Insert Listbox Items to Database – Programming, Pseudocode Example, C# Programming Example
Database Windows Form

C# – Insert Listbox Items to Database

Here in this article, I will show you How to insert listbox items to MS Access Database.


Step 1:

Open MS Access, click on a Blank Desktop Database. Give the database name “dbTest.accdb“. and then click Create.

Step 2: Now create a Table in database, You can name a table anything you want, here I named it “Category” . There are two columns in the table ID, CategoryName like the following,

Table Design

Id >> AutoNumber

CategoryName >> Text


Step 3: Now open Visual Studio, start a new Windows Form  Application and give any name you want.

Step 4: Now Drag and Drop database file from the Documents to the Project Directory folder.

Step 5: Form Design:


Step 6: Write a Namespace for connectivity as in the following code snippet.

Step 7: Define global variables.


Step 8: Create source code for Insert to ListBox Button


Step 9: Create source code for Insert to Database Button


Finally, finished  the project.

Here are the all codes:


Output :






Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: