Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / August 2008



Tip: Looking for answers? Try searching our database.

Spurious Error 9: Subscript out of range

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tony Proctor - 17 Jul 2008 11:14 GMT
I'm looking for some suggestions here as a section of code is misbehaving
at only one site (2 machines) and works elsewhere. The code is part of a
multi-threaded ActiveX EXE. The exact same EXE is installed at several
sites.

At this one site, a subscript-out-of-range error occurs. Because of the
extensive logging I know that it occurs on entry to the following
initialisation loop and that it never gets through one iteration of it
(because no activity is logged on other thread IDs)

  ReDim tThreads(0 To iThreadCount - 1)
   For iThread = 0 To UBound(tThreads)
       With tThreads(iThread)
           Set .oThread = CreateObject(sThreadProgID)
           .lThreadID = .oThread.Initialise(sWorkDir)
       End With
   Next iThread

I know that iThreadCount is 5 because the logging explicitly records it just
before entry to the loop

I'm guessing that either the ReDim has not created any entries (causing
UBound to fail), or that the internal With-block initialisation is failing

tThreads is an array of private UDTs. I have experienced issue before with
Private UDTs, especially in conjunction with a With block. For that reason,
we compile using VB6 SP5 and ensure a minimum MSVBVM60.DLL of 6.0.96.90

I've checked this DLL version though and can't fault it. There's obviously
some other difference in the environment between the machines that work and
the few that fail but I don't know enough about the run-time dependencies
involved to point the finger at anything specific

   Tony Proctor
Nico Notter - 05 Aug 2008 12:23 GMT
Some time ago I've had also problems adressing redimed
arrays when the new dimension was less than the old one. In
my case it helped to execute a ReDim xxx(0) just before
assigning new space via ReDim xxx(n).
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.