Tuesday, June 1, 2010

Auto Complete Option in ComboBox in C#

ArrayList ObjArrayList=new ArrayList():


private void Form_Load(object sender, EventArgs e)
{
ObjArrayList.Add("a");

ObjArrayList.Add("aa");

ObjArrayList.Add("b");

ObjArrayList.Add("bb");

ObjArrayList.Add("c");

ObjArrayList.Add("cc");

ObjArrayList.Add("d");

ObjArrayList.Add("dd");

OR

cmbSymbol.DataSource = ObjArrayList;// You can Give DataSource Also

ComboBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;

ComboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;

AutoCompleteStringCollection dataSymbols = new AutoCompleteStringCollection();



for (int i = 0; i < ObjArrayList.Count; i++)//If You are using DataSet then user Ds.Tables[0].Rows.Count

{

dataSymbols.Add(ObjArrayList[i].ToString());

}

ComboBox1.AutoCompleteCustomSource = dataSymbols;

}

No comments:

Post a Comment

Mat Table Angular

Mat Table in Angular Mat table is used to display data . its a material designed styled data-table . For using Material Table MatTableMo...