Spot the error
Here's some actual VB6 code. Can you spot the error that will cause the program to malfunction?
The premise here: There are five locations, but the data is stored both in remote computers (locations 0-5) or on the local hard drive (6-11). Check_Stores contains the code to run on the data and is not part of the problem
Code:
Private Sub cmdStart_Click()
StatusBar1.Panels(1).Text = "Please wait....."
On Error GoTo ErrorHandler
StartNumber = 0 ' 1'st Number (0 or 6)
EndNumber = 5 ' 6th Item (Last Item 5 or 11)
LocationNumber = 0 ' Location Index (0-5)
optIndex = 0 ' Indicates location and whether remote (0-5) or local (6-11)
If chkAllStores.Value = Checked Then ' Do All Stores
If chkLocal.Value = Checked Then ' Use local files
StartNumber = StartNumber + 6
EndNumber = EndNumber + 6
End If
For optIndex = StartNumber To EndNumber
Option1(LocationNumber).Value = True
Call Check_Stores
LocationNumber = LocationNumber + 1
Next optIndex
Else 'Single Location
If chkLocal.Value = Checked Then optIndex = optIndex + 6 ' Use local files
Call Check_Stores
End If
ErrorHandler:
Select Case Err.Number
Case 0
' Do Nothing
Case 20
' Do Nothing
Case Else
MsgBox (Err.Number & " " & Err.Description)
Err.Clear
End Select
Resume Next
End Sub
.
PC - Ubuntu 15.04 64bit Desktop
HP Pav G60-236US 3GB RAM Laptop, Ubuntu 15.04 64bit and Win7 Home
"So Daddy, how come you telling me stealing not right when YOU copying DVDs? How come? How Come?"
RIP Ramesh ...