Load Data in the ListBox Using C# and SQL Server




In this tutorial, I will teach you how to load data in the ListBox using C#.net and Microsoft SQL Server Management Studio 2005. ListBox is an item control, wherein it enables you to display a list of items from which the user can select by clicking it. This method has the ability to load more data in the ListBox from the database according to the functionalities in a certain situation.


To start with:


  • Create a database and name it “dbname”. Then, insert data depending on your desire.
  • Open Microsoft Visual Studio 2008 and create new Windows Form Application.
  • Do the Form as follows.


  • Go to the Solution Explorer, click the “View Code”  to display the code editor.


  • Declare all the classes and variables that are needed.

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

  • Create a method for retrieving data in the SQL database to the ListBox.

  • Go back to the design view, double click the Form and do the following codes for setting up the connection between SQL server and C#.net.

  • Go back to the design view, double click the Button and do the following codes calling the retrieve method that you have created.


For all students who need programmer for your thesis system or anyone who needs a sourcecode in any programming languages. You can contact me @ :

Email – [email protected]
Mobile No. – 09305235027 – tnt


Download Sourcecode

Leave a Comment!

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