I am working on debugging a program at my job. My coworker who wrote the program passed away last year, so it fell to me to try and update some changes we needed. I am a novice at programming and VB6 but was able to make the changes. Unfortunately, one bug remains.
Basically, the program collects data from another program and displays it in a column. The operator selects data points for various gases, then drags the data from a "collected data column" into a "report column". The operator continues to do that for all samples. If that operator needs to delete one of the columns from the report column, the program moves all other data to the left to fill out the table left to right. But when the operator does that, the value in the very last row of the first column changes from whatever value it is to "ND" (which means not detected).
The code that creates and clears the columns looks like this:
Private Sub UpdateColumnDisplay() Code to collect data which includes a loop for all columns At end of loop: Next Value ' Value = row Next Column Call ClearColumns(0) End Sub
My first question - why is he passing a zero in ClearColumns? What does that do?
Then when you get to the ClearColumns procedure, it looks like this:
Private Sub ClearColumns(ColumnToErase As Long) Dim Column As Long Dim Value As Long If ColumntoErase > 0 grdReport.Col = ColumnToErase For Value = 0 to 13 'these are the rows grdReport.Row = Value grdReport = "" Next Value Else For Column = ReportColumnNumber(ReportPage) + 1 To NumberGridColumns grdReport.Col = Column For Value 0 to 13 grdReport.Row = Value grdReport = "" Next Value Next Column End If grdReport.Row = 0 For Column = ReportColumnNumber(ReportPage) + 1 To NumberGridColumns grdReport.Col = Column grdReport.Text = "("& Str$(Column + ((ReportPage - 1) * 5))&")" Next Column End Sub
Any help finding this bug would be appreciated. Thank you!