Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

Auto Complete Textbox

3.29/5 (6 votes)
5 Jan 2011CPOL 28.5K  
Auto Fill the content of text box for well known entries
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 the first two letters are typed. There are two important ways in which we can save the typing. One is auto complete by filling the remaining text and the other one is providing a suggestion in the form a matching list to pick the correct one.

For example, have a look at the form: http://www.stooorage.com/show/650/1558564_pic1.jpg[^].

A: 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. You can try other options also
3) Set the below specified value for the Property AutoCompleteCustomSource
Murali Manohar
Mike Starr
Robert Smith
John Paul
Mary Jane
Muthiyah

B: For the second text box, try different auto complete mode:
1) Run the Application
2) In the First text box, type only the letter M

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)