Hello all.
I have a For Next loop that seems to skip my for statement. Basically, I'm using nested for loops to go through a database and grab various information about some TIFF images. By the time I get to looping though the paths of the TIFFs (code below), it hits the problem:
It hits the for when it initially enters the loop, it increments my counter, checks the tiff number, then formats the images how i need them. Then it hits the next. I have a breakpoint on both the For and the Next. If I step through on the Next, it skips the For and goes to tiffNumber = tiffNumber + 1.
At first I thought maybe it wasn't showing me that line, which is why I put a breakpoint on both. What i've found that its doing is, say my datatable has 8 rows in it, it will loop through all 8 rows of images, doing what I want, then it will hit the For and do it again, until its hit all 8 rows. So instead of ending with me having 8 images copied to my output folder and formatted, I have 64 images copied to my output folder and formatted.
For the life of me I can't figure out why this is happening. Has this happened to anyone else? And if so how did you correct it...if possible. Thank you all for reading this and for your time.
I have a For Next loop that seems to skip my for statement. Basically, I'm using nested for loops to go through a database and grab various information about some TIFF images. By the time I get to looping though the paths of the TIFFs (code below), it hits the problem:
VB.NET:
'Now put the tiffs in proper format for output
For Each drTiff As DataRow In ds.Tables("TiffImages").Rows
'Set the tiff# for the Fetch Format
tiffNumber = tiffNumber + 1
'make sure that the tiff number doesn't exceed 999
If tiffNumber > 999 Then
tiffNumber = 1
DocTypeNumber = DocTypeNumber + 1
End If
'Call the sub to do the formatting
FormatTiffs(drTiff.Item(0).ToString, drTiff.Item(1).ToString, _
tiffNumber, DocTypeNumber, drBatch.Item(0).ToString, drLoan.Item(0).ToString, drDocType.Item(1).ToString)
Next ' drTiff
It hits the for when it initially enters the loop, it increments my counter, checks the tiff number, then formats the images how i need them. Then it hits the next. I have a breakpoint on both the For and the Next. If I step through on the Next, it skips the For and goes to tiffNumber = tiffNumber + 1.
At first I thought maybe it wasn't showing me that line, which is why I put a breakpoint on both. What i've found that its doing is, say my datatable has 8 rows in it, it will loop through all 8 rows of images, doing what I want, then it will hit the For and do it again, until its hit all 8 rows. So instead of ending with me having 8 images copied to my output folder and formatted, I have 64 images copied to my output folder and formatted.
For the life of me I can't figure out why this is happening. Has this happened to anyone else? And if so how did you correct it...if possible. Thank you all for reading this and for your time.