Fill comboBox in C# Windows Form Application from Sql Database – C# Programming Example
Database Windows Form

Fill comboBox in C# Windows Form Application from Sql Database

Here in this post, I will show you how to fill / populate data to comboBox control from Sql database records in C# Windows Form Application.

The listbox will populated from database table using sqlDataReader.

Step 1: We will use the Customers table in Northwind database.

Step 2:  In the next step, create a ComboBox control at design-time, you simply drag and drop a ComboBox control from Toolbox to a Form in Visual Studio.
Step 3: 
Write a Namespace for connectivity as in the following code snippet.

Step 4: Define global variables.

Step 5: Create source code for  Form_Load.

 

Here are the all codes:

Output:

1 Comment

Leave a Comment

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

%d bloggers like this: