subscript out of range error

I have the attached project in vb6.  Within the form BlockList I have a "subscript out of range" error.  The form BlockList pulls all the Blocked sites across all the files located in the test folder.  When selecting shorter date ranges, everything works fine.  However the error occurs when I choose a long date range such as 11/1/2014  to 11/24/2014.

Thank you for your help
CB.zip
al4629740Asked:
Who is Participating?
 
GrahamSkanRetiredCommented:
Your program reads in a number of text files whose name corresponds to a date, so which particular files are read depend on the dates that are chosen.

The code looks for the text "BlockedIP" in each line of the file. If that is found then the Split() function to is used to produce an array, splitting the line around the word "keyword". It then tries to read the second element of the array (index 1). However not all lines that contain "BlockedIP" also have "keyword", so there is no second element in some cases,

I suggest that you test the Ubound value of the array before trying to read beyond the first element.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
sorry, but I cannot debug this, as I don't have the way to reproduce the issue
you need to debug into the code (with breakpoints) to see on which line it is getting that error, so to find out the root cause of the error.
I presume it's a logical error somewhere in how you fetch the intCount value...
0
 
Martin LissOlder than dirtCommented:
If no one comes up with the answer I'll fix it on Sunday.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Martin LissOlder than dirtCommented:
It's a problem with the data and not the number of files. For example the 110214 file contains this record

18:46:11 [ReadINI] BlockedIP=192.168.1.100

According to what I understand about the requirements, that record should be shown in the grid because it contains "BlockedIP", but the code assumes that the BlockedIP records contain "keyword" and the above record doesn't so the current code fails. Should records like that be included and if so what should be in each column of the grid?
0
 
al4629740Author Commented:
Martin

Let me find out how to handle those instances.
0
 
al4629740Author Commented:
Martin,

Those type of records can be left out and ignored

18:46:11 [ReadINI] BlockedIP=192.168.1.100
0
 
Martin LissOlder than dirtCommented:
I assume you mean that if the record contains "[ReadINI]" that it should be ignored. Correct?
0
 
al4629740Author Commented:
Yes, since I think those are the only lines containing that string
0
 
Martin LissOlder than dirtCommented:
Try this.
Q-28579489.zip
0
 
Martin LissOlder than dirtCommented:
@al4629740: I didn't notice GrahamSkan's answer in post ID: 40495872 which pointed out what caused the error and which gave a method to avoid the error and still include that record in the grid. From what I determined from you that isn't exactly what you wanted, but in any case if my answer turns out to be what you want then he should get some of the points.
0
 
al4629740Author Commented:
Agreed.
0
 
al4629740Author Commented:
Thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.