Connecting Tech Pros Worldwide Forums | Help | Site Map

Subscript out of range while checking on Array.

Newbie
 
Join Date: Oct 2008
Posts: 29
#1: Sep 9 '09
i have an array for each mailbox. if i ask the array of mailbox 1,2,3,4... it returns a "1" if there are unread messages.
If there are no unread messages i receive "". (empty)


Yet, the moment I check it returns an error: "subscript out of range"

How can I check if a value of an array is empty?



If ArrUnreadMsg(ADORstMailbox("IdtMailbox")) = "1" Then

If it's "1", the loop works.
If it's "", i get an error.


The thing that happens behind the screen:

If there are unread messages, a Redim Preserve is done with the mailboxnumber.
so when there are no unread messages, the redim does not happen.

Can I check if the array is filled in at a certain position?

thanks

Member
 
Join Date: Jul 2006
Location: Chennai
Posts: 35
#2: Sep 17 '09

re: Subscript out of range while checking on Array.


Try like this example


j = 0
Do While Not j > uBound(MyArray)
Response.write(MyArray(j))
j = j + 1
Loop
Reply


Similar ASP / Active Server Pages bytes