Malvika Dave

Malvika Dave

  • NA
  • 1
  • 644

how to filter records from listbox without using sql stateme

May 28 2016 3:14 AM
i want to filter items from listbox as some character typed in combobox ??
suppose when i type "M" in combobox then listbox filter its itemlist which contains
"M" in C# without using SQL STATEMENT...
 
below is my code.....
 
 
private void FillListBoxes()
{
int count = FillList.Rows.Count;
for (int k = 1; k <= count; k++)
{
var itemList = lbSearch.Items.Cast<String>().ToList();
if (count > 0)
{
lbSearch.Items.Clear();
//filtertheitemsandaddthemtothelist
lbSearch.Items.AddRange(itemList.Where(i => i.Contains(cStockTypeName.Text)).ToArray());
lbSearch.Items.Add(FillList.Rows[k]["CatName"].ToString());
}
}
 

Answers (1)