Hello
After two days of struggling I have come for some help. I have a listview of contact names that I want to search with text added into a textbox. It can either filter these as the text is entered or by a button search ... I haven't got anywhere with either so far.
private void btnSearch_Click_1(object sender, EventArgs e)
{
for (int i = 0; i < lvContacts.Items.Count; i++)
if (lvContacts.Items[i].ToString().Contains(txtSearch.Text.ToLower()))
{
//lvContacts.Items[i].Selected; // THIS DOESNT WORK ... as I'm sure you know
lvContacts.Items[i].BackColor = Color.CornflowerBlue;
}
}
private void txtSearch_TextChanged(object sender, EventArgs e)
{
lvContacts.SelectedItems.Clear();
for (int i = 0; i < lvContacts.Items.Count; i++)
if (lvContacts.Items[i].ToString().Contains(txtSearch.Text.ToLower()))
{
lvContacts.Items[i].BackColor = Color.CornflowerBlue;
}
}
Help thank fully received ... John.