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).