SIGN UP MEMBER LOGIN:    
ARTICLE

Auto Complete Text Box in C#

Posted by Sivaraman Dhamodaran Articles | Visual C# December 05, 2010
In this Article I will show the usage of Auto Complete Text box in C#.
Reader Level:
Download Files:
 

Introduction

 

The auto complete feature of the text box allows the user to enter part of the details in the text box and complete the remaining automatically. Say for example a country text box, which will fill the entry India when first two letters are typed. There are two important way we can save the typing. One is auto complete by filling the remaining text and other one is providing a suggestion in the form a matching list to pick the correct one.

 

In this article we will design the auto complete text box with above said two kind of auto complete feature. This article uses only form designer and there is no added.

 

Form design
 

Create a Visual C# Windows application using VS2005. Add two label and two text boxes. Use the following picture for reference:

 

Pic1.JPG
 

 

For the first text box set the Following Properties:
 

1. Set CustomSource value for the property Autocompletesource

2. Set Append value for the property AutoCompleteMode

3. Set the below specified value for the Property AutoCompleteCustomSource
 

Mahesh Chand

Sivaraman Dhamodaran

Praveen Kumar

Hashit viyas

Dentin Joy

Suthish Nair

Sure Meenakshi

Mike Gold

 

For the second text box set the same property and values as specified above with the exception thatAutoCompleteMode be set to Suggest.

 

Run the Application and test

 

1. Run the Application

2. In the First text box type only the letter S
 

Pic2.JPG
 

 Note that the auto complete (Append) tries to fill the text box value based on the alphabetical order.
 

3. Now type U and then T your intension is to get Suthish Nair in the text box.

4. Now go to the second text box and experiment it yourself. Below is the screen shot anyhow:

 

Pic3.JPG
 

 

Note: The attached sample is created in VS2005.

Login to add your contents and source code to this article
share this article :
post comment
 

Yes it is Crap if you don't know that you can access most of the properties at runtime.

Posted by Sivaraman Dhamodaran Jan 24, 2011

if we want to enter on run time to save in collection then wat to do dear??

Posted by Fawad Mirza Jan 24, 2011

its crappp

Posted by Fawad Mirza Jan 24, 2011
Nevron Gauge for SharePoint
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
    ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
Team Foundation Server Hosting
Become a Sponsor