How to Create an AutoComplete in a TextBox in VB.Net

2
4661

How to Create an AutoComplete in a TextBox in VB.Net

This tutorial is all about How to Create an AutoComplete in a TextBox in VB.Net.
When searching a record from the database using a TextBox in VB.Net, commonly, it’s hard for us to search the exact record.

So, In this tutorial, I created an autosuggest textbox, so that, it will be easy for you to search the correct record in the table.

For instance, the word “itsourcecode”.

This tutorial can answer the questions on How to Create an Autocomplete in a textbox in vb.net.

Let’s begin:

Steps How to Create an AutoComplete in a TextBox in VB.Net

Step 1: First, create a database and name it “employeesdb” in the MySQL Database. after that, set this query for creating a table.

Step 2: After creating a table in the database, Insert all the records in the table that you have created.

 

Step 3: Open the Microsoft Visual Studio 2008 and create a new Windows Form Application. After that, Put a TextBox and a Label.
autocompleteform
Step 4: Click the TextBox and go to the properties. In the properties, select the Suggest for the AutoComplete mode and select Custom Source for the AutoComplete Source.
autocompleteproperties
Step 5: After setting up the properties of a textbox, go to the solution explorer and hit the code view.
autocompletecodeview
Step 6: In the code view, set up your connection and declare all the classes that are needed.

Reminder: Before setting up your connection make sure that you will add MySql. Data. dll as your reference. So you will not encounter errors. Follow the instructions here the complete guide to add mysql.data.dll.

Step 7: After the declaration, go back to the Form Design and double click it. Now, you have to set up the AutoComplete in the TextBox on the first load of the Form.

Complete Source Code is included. Download it and run on your computer.

Download here.

If you want to learn more about how to master vb.net with MySQL database in 30 minutes, watch and follow the instructions given the video.

Inquiries

If you have any questions or suggestions about this tutorial on how to create an autocomplete in textbox using vb.net. please leave a comment below.

Readers might read also:

 

2 COMMENTS

Leave a Reply

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