I’m reviewing an automatic translation of VB6 code to C# and the convertor translated someArray(3) to someArray[3]. But accordingly to the old code documentation it should pick the third element not the fourth as it is doing in the translated version.
Are array indexes 0-based in VB6? Or do they start at 1?
Yes – arrays are (generally) 0 based in VB6
The exceptions to this are when the explicit
Dim someArray(1 To 10) as Intsyntax has been used, or whenOption Base 1is declared at the top of the code module.It’s
Collectionsthat aren’t – when you loop throughCollectionobjects I’m pretty sure that they are 1 based.