There is a property for this:
Additional documentation information can be found
here[
^].
I modified your code sample a bit:
int searchIndex = 0;
foreach (ListViewItem item in listview1.Items)
{
if (item.SubItems[2].Text == name.Text)
{
listview1.Items[searchIndex].Selected = true;
label1.Text = item.SubItems[0].Text;
label2.Text = item.SubItems[1].Text;
label3.Text = item.SubItems[2].Text;
}
else
{
listview1.Items[searchIndex].Selected = false;
}
searchIndex++;
}