Steve,
The only reason you're getting the IndexOutOfRange is that you're probably not checking the ListView's .SelectedIndices.Count property prior to processing anything in the SelectedIndexChanged event handler. So, try something like this:
private void oListView_SelectedIndexChanged(object sender, System.EventArgs e)
{
if (this.oListView.SelectedIndices.Count > 0)
{
}
}
~~Bonnie
>Hi,
>
>How can you programmatically set the focus to a particular row in a listview? We are using listviews and if user clicks on part of listview where there is no row, it fails with IndexOutOfRange.
>
>What I want to do is catch this and set focus to last (or first) row in the listview.
>
>Thanks for any help
>
>Steve