void SearchText(string text, bool caseSense) { string textToSearch = text.Trim(); if (caseSense) { textToSearch = text.Trim().ToLower(); } resultList.BeginUpdate(); resultList.Items.Clear(); if (textToSearch != "") { int count = _model.GetDataCount(); for (int i = 0; i < count; i++) { var item = _model.GetData(i); if (item.Text.IndexOf(textToSearch) != -1) { resultList.Items.Add(item); } } } resultList.EndUpdate(); }