We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

List view On Selected Index Changed Event

Thread ID:

Created:

Updated:

Platform:

Replies:

8718 Nov 17,2003 09:26 PM Dec 10,2003 08:55 PM Windows Forms 4
loading
Tags: FAQ
Peter
Asked On November 17, 2003 09:26 PM

Hello, I do have the following code in ListView_ON Click even which is working just fine. glbRelationID = ListView2.SelectedItems.Item(0).SubItems(1).Text When I try to place the same code in ListView_On_Selected_Index_Changed event I receive an error. Does anyone know what I should change. Thank you. Peter

suda
Replied On November 21, 2003 01:49 PM

> Hello, > I do have the following code in ListView_ON Click even which is working just fine. > > glbRelationID = ListView2.SelectedItems.Item(0).SubItems(1).Text > > When I try to place the same code in ListView_On_Selected_Index_Changed event I receive an error. Does anyone know what I should change. Thank you. > Peter > > Hi peter add this line before if selectedindex = -1 exit sub It will solve your problem

Administrator [Syncfusion]
Replied On November 22, 2003 03:38 PM

Hi Suda. Thank you for the responce. Actually I'm not trying to avoid the error. I would like to select the item when the index Changes. Please advise. Thank you.

suda
Replied On November 24, 2003 01:37 PM

Hi peter, When Selected Index = -1 then SelectedItems Property will Return an Exception, I am also working around that if you don't select any value also it is throws an Exception error,Other than that it is working for me any other alternative please post it I will have a look. Thank you Peter Hello, > I do have the following code in ListView_ON Click even which is working just fine. > > glbRelationID = ListView2.SelectedItems.Item(0).SubItems(1).Text > > When I try to place the same code in ListView_On_Selected_Index_Changed event I receive an error. Does anyone know what I should change. Thank you. > Peter > > Hi peter add this line before if selectedindex = -1 exit sub It will solve your problem

Administrator [Syncfusion]
Replied On December 10, 2003 08:55 PM

I understand that but how do you know which item is bein selected?

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;