Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

First fire of 'SelectedIndexChanged' event works, but not on 2nd fire

Status
Not open for further replies.

DotNetter

Programmer
May 19, 2005
194
US
I have this line in my SelectedIndexChanged event:[tt]
Dim SelectedClassID As Integer = CType(lvwRequestSummary.SelectedItems(0).Tag, Integer)[/tt]

The tag is set to a valid integer. That does not seem to be the problem.

On the first fire of this event, this line works and the variable is properly assigned to an integer. On the second fire of the event, it blows up and tells me that the "0" in the index of "lvwRequestSummary.SelectedItems(0)" is "out of the range of valid values. Parameter name: index"

How could this be?

Thanks!
Dot
 
can you use this in that event and see what happens


Dim iTest As Integer=-1
iTest=lvwRequestSummary.SelectedItems.Count
If iTest > 0 Then
Dim SelectedClassID As Integer = CType(lvwRequestSummary.SelectedItems(0).Tag, Integer)
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top