Friday 2 December 2011

How to Bind a Lisbox to Database in C# (.NET)

Bind Listbox to Dataset using Visual Studio

Following steps would help you in connected a database/dataset to the list box

Step1: Add a List Box control to the form and select the DataSource from quick edit

Step 2: Select appropriate data source type (We are going to connect to an SQL Server DB)


Step 3: Select Appropriate Database Model


Step 4: Add a connection to database and select appropriate DB

Step 5: Select appropriate field you want to show in listbox


A dataset will be created and will be used for it. You can write necessary code in listbox selectionchange events depending upon the business logic

0 comments:

Post a Comment