Popular Posts

Oct 3, 2012

AutoComplete TextBox in C#


         


   We are familiar with the auto completion text feature available in browsers, search controls and other controls. The auto completion feature is when you start typing some characters in a control, the matching data is loaded automatically to make easier to type. 


 In formload method type the code below:

            comboBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
            comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;

            // AutoCompleteStringCollection
            AutoCompleteStringCollection data = new AutoCompleteStringCollection();
            data.Add("Khalid");
            data.Add("Sabus");
            data.Add("Sagar");
            data.Add("Jubayer");
            data.Add("Jamil");
            data.Add("Jaki");
            data.Add("Jibon");
            data.Add("Tomal");
            data.Add("Jamal");

            comboBox1.AutoCompleteCustomSource = data;


            comboBox2.AutoCompleteSource = AutoCompleteSource.CustomSource;
            comboBox2.AutoCompleteMode = AutoCompleteMode.SuggestAppend;


            comboBox2.AutoCompleteCustomSource = data;



No comments:

Post a Comment