Write a code to select an item in the ListView control programmatically in C#?

To select an item from the ListView control, you can use the following code snippet:
//Make sure the listview has focus
listview1.Focus();
listview1.Items[i].Selected = true;