Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Listview focus on row
Message
De
19/05/2005 13:08:19
 
 
À
19/05/2005 12:28:52
Steve Jones
Business Systems Services Uk Ltd
Swansea, Royaume Uni
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01015871
Message ID:
01015896
Vues:
21
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)
	{
		// whatever code you need.
	}
}
~~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
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform