I have 3 loops, the outer loop goes from 0 to 4, the middle from 0 to 15 and the inner is 0 to 15. The problem is that only the outer loop actually goes to its max, the middle and inner loops exit before the counter reaches the max value of 15. The same exact loop works perfectly in VB6, what is going on here? What am I missing?
Code:
For ha = 0 To stb.sS.scan.numHa - 1 Step ha + 1
                    stbd.VBSCSIResetHBA(Convert.ToInt32(ha))
                    For lun = 0 To stb.MAX_LUN - 1 Step lun + 1
                        For scsiId = 0 To 15 Step scsiId + 1
                            devType = stbd.VBSCSIGetDeviceType(ha, scsiId, lun)
                            If devType > 0 Then
                                If devType > &HES Then
                                    devType = 16
                                End If
                                stb.sS.scan.numDev(devType) = stb.sS.scan.numDev(devType) + 1
                               
                                Select Case devType
                                    Case stb.TYPE_TAPE
                                        stb.sS.scan.tapeNexus(stb.sS.scan.numDev(devType)).ha = ha
                                        stb.sS.scan.tapeNexus(stb.sS.scan.numDev(devType)).target = scsiId
                                        stb.sS.scan.tapeNexus(stb.sS.scan.numDev(devType)).lun = lun
                                        device = "TAPE DRIVE"
                                        collection.UUT(scsiId).ha = ha
                                        collection.UUT(scsiId).target = scsiId
                                        collection.UUT(scsiId).lun = lun

                                    Case stb.TYPE_LIBRARY
                                        stb.sS.scan.libNexus(stb.sS.scan.numDev(devType)).ha = ha
                                        stb.sS.scan.libNexus(stb.sS.scan.numDev(devType)).target = scsiId
                                        stb.sS.scan.libNexus(stb.sS.scan.numDev(devType)).lun = lun
                                        device = "LIBRARY/LOADER"

                                    Case stb.TYPE_SNC
                                        stb.sS.scan.sncNexus(stb.sS.scan.numDev(devType)).ha = ha
                                        stb.sS.scan.sncNexus(stb.sS.scan.numDev(devType)).target = scsiId
                                        stb.sS.scan.sncNexus(stb.sS.scan.numDev(devType)).lun = lun
                                        device = "SNC"

                                 End Select
                             
                            End If
                        Next scsiId
                    Next lun
                Next ha