Solved

subscript out of range error

Posted on 2014-12-11
12
110 Views
Last Modified: 2014-12-15
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
0
Comment
Question by:al4629740
12 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 40495751
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
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 150 total points
ID: 40495872
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
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40496890
If no one comes up with the answer I'll fix it on Sunday.
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 46

Expert Comment

by:Martin Liss
ID: 40499754
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
 

Author Comment

by:al4629740
ID: 40500160
Martin

Let me find out how to handle those instances.
0
 

Author Comment

by:al4629740
ID: 40500627
Martin,

Those type of records can be left out and ignored

18:46:11 [ReadINI] BlockedIP=192.168.1.100
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40500685
I assume you mean that if the record contains "[ReadINI]" that it should be ignored. Correct?
0
 

Author Comment

by:al4629740
ID: 40500710
Yes, since I think those are the only lines containing that string
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40500747
Try this.
Q-28579489.zip
0
 
LVL 46

Assisted Solution

by:Martin Liss
Martin Liss earned 350 total points
ID: 40501565
@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
 

Author Comment

by:al4629740
ID: 40501622
Agreed.
0
 

Author Closing Comment

by:al4629740
ID: 40501936
Thank you
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
vb6 programatically bring window to front 8 71
TT Auto Dashboard 13 92
MS Access 03, TransferText, decimal places 8 69
Create Files based on Cell Values in a Range in Excel 12 39
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question