Filling Data in the ComboBox with Two Display Members Using C# and SQL Server

0
80

FillCBOtwoDisplayFig.3In this tutorial, I will teach you how to fill the data in the combo box with two display members using C#.net and SQL Server 2005 express edition. This method has the capability to display two columns in a combo box from the table of the database. Using concatenation, this guarantees you that it will work because concatenation is a procedure that joins two or more fields in the table of the database.

 

Here’s the link for creating a database. Click Here

 

Let’s begin:

 

Step 1. Open Visual Studio 2008 and create new Windows Form Application. After that, drag a comboBox in the Form.

FillCBOtwoDisplayFig.1

 

Step 2. Go to the Solution Explorer, hit the “View Code”  to fire the code editor.

FillCBOtwoDisplayFig.2

 

Step 3. Declare and initialize the classes that are needed.

Note: Put “using System.Data.SqlClient;” above the namespace to access sql server library.

 

Step 4. Create a method for filling data in the comboBox with two display member.

 

Step 5. Set up the connection between SQL Server database and C#.net and call the method that you have created on the first load of the form.

Output:

FillCBOtwoDisplayFig.3

For all students who need a programmer for your thesis system or anyone who needs a source code in any programming languages. You can contact me @ :
Email – [email protected]
Mobile No. – 09305235027 – talk’nText

 

Download Sourcecode

Facebook Comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here