private void BtnSearchAll_Click(object sender, EventArgs e) { var listOfItems = new List <int>(); for (int i = 0; i <= LstUnhashed.Items.Count - 1; i++) { if (ItemFound(i)) { listOfItems.Add(i); } } if (listOfItems.Any()) { LstUnhashed.ClearSelected(); LstUnhashed.BeginUpdate(); foreach (var item in listOfItems) { LstUnhashed.SetSelected(item, true); } LstUnhashed.EndUpdate(); } LstUnhashed.Focus(); }
private void BtnSearchNext_Click(object sender, EventArgs e) { for (int i = LstUnhashed.SelectedIndex + 1; i <= LstUnhashed.Items.Count - 1; i++) { if (ItemFound(i)) { LstUnhashed.ClearSelected(); LstUnhashed.SetSelected(i, true); LstUnhashed.Focus(); break; } } }
private void BtnSearchPrevious_Click(object sender, EventArgs e) { for (int i = LstUnhashed.SelectedIndex - 1; i >= 0; i--) { if (ItemFound(i)) { LstUnhashed.ClearSelected(); LstUnhashed.SetSelected(i, true); LstUnhashed.Focus(); break; } } }