Autocomplete in a ComboBox Using C# and SQL Server

0
889

autocompleteCBOSQLfig.3
In this tutorial, I will teach you how to create an Autocomple in a Combobox using C#.net and SQL Server 2005. With this, it will suggest the records when you start to type in the combobox then, you don’t have to click anymore the dropdown or scroll down the list of records that you’re going to select.

 

Let’s begin:

 

Create a database and name it “dbcombo”.

After creating database, do the following query for creating a table in the database that you have created.

Open Microsoft Visual Studio 2008 and create new Windows Form Application for C#. Then do the following design of a Form just like this.

autocompleteCBOSQLfig.1

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

autocompleteCBOSQLfig.2

In the code editor, declare all the classes that are needed.

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

After declaring the classes, create a method for retrieving data in the database with autocomplete in a  ComboBox.
Finally, go back to the design view double click the form and create a connection between SQL server and C#.net. Then, call the method that you have created.
 

Output:

autocompleteCBOSQLfig.3

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

 

Facebook Comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here