Create Auto Complete Textbox

  • Thread starter Thread starter Melson
  • Start date Start date
M

Melson

Hi

Can anyone help please. How can I create a Auto complete textbox using C#.

Please help.

Regards
Melson
 
Set the AutoCompleteCustomSource
http://msdn2.microsoft.com/en-US/library/system.windows.forms.textbox.autocompletecustomsource.aspx
to a string collection of the items that can be used for autocompletion. You
can also use the AutoCompleteSource for some common items.

This code should get you started ...
m_List = new AutoCompleteStringCollection();

m_List.Add("Red");

m_List.Add("Royal Blue");

m_List.Add("Pink");

m_List.Add("Blue");

m_List.Add("Purple");

m_List.Add("Orange");

m_List.Add("Green");

this.textBox1.AutoCompleteCustomSource = m_List;

this.textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;

this.textBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;


You set the AutoComplete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top