Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I use for each element... but element come like a object, where in fact should be string.Can any one help me, how can i make a condition to count it??

What I have tried:

try for each element
HttpContext.Current.Session("idTicket")
Posted
Updated 1-Nov-18 1:14am

1 solution

Not sure what exactly the problem is that you need to get solved but this code should count the items in the collection that you posted above:

VB
Dim Count As Integer = 0
For Each item As Object In HttpContext.Current.Session("idTicket")
    Count = Count + 1
Next
Debug.WriteLine(Count)


For Each...Next Statement (Visual Basic) | Microsoft Docs[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900