Cast from type 'ListItem' to type 'Integer' is not
Hi
I'm trying to count how many items are checked in a listbox in ASP.NET (webform). I tried the following code:
Dim index As Integer
Dim counter as integer = 0
For Each index In lstCustomers.Items()
If lstCustomers.Items(index).Selected Then
counter = counter + 1
End If
Next
I get the following exception: Cast from type 'ListItem' to type 'Integer' is not valid
What am I doing wrong? Could someone please help.
|