G
Guest
I have an array that I am populating from a database. I am looping through
the array to write the values to a datagrid. At this point, I'm stuck. I
can't figure out how to read the first four values from the array, then go on
to the next four values, then go on to the to the next, etc.
This is an example of the code I have so far.
cnt = 0
start = 1
For idx = 1 To 10
If SpecsDataSet.Tables("Specs").Rows(0).Item("Description " &
idx).ToString <> "" Then
ReDim Preserve arDescriptions(cnt)
arDescriptions(cnt) =
SpecsDataSet.Tables("Specs").Rows(0).Item("Description " & idx).ToString
row = dtScrewDims.NewRow()
dtScrewDims.Rows.Add(row)
row.Item(cnt) = arDescriptions(cnt)
End If
'We have to figure out a way to print out the first four dim. fields, then
go to
'the next four, then to the next, etc. within this loop. cnt is the variable
'that we need to use to increment by.
For idxDims = start to (column_count + start - 2)
row.Item(idxDims) = arDimensions(cnt) 'These items come from the
arDimensions array.
cnt = cnt + 1
Next
cnt = 0 'I know that doing this resets the count to zero and causes my
problem, but I can't figure out how to move to the next number without
getting a "column(cnt) cannot be found error.
Next 'idx
the array to write the values to a datagrid. At this point, I'm stuck. I
can't figure out how to read the first four values from the array, then go on
to the next four values, then go on to the to the next, etc.
This is an example of the code I have so far.
cnt = 0
start = 1
For idx = 1 To 10
If SpecsDataSet.Tables("Specs").Rows(0).Item("Description " &
idx).ToString <> "" Then
ReDim Preserve arDescriptions(cnt)
arDescriptions(cnt) =
SpecsDataSet.Tables("Specs").Rows(0).Item("Description " & idx).ToString
row = dtScrewDims.NewRow()
dtScrewDims.Rows.Add(row)
row.Item(cnt) = arDescriptions(cnt)
End If
'We have to figure out a way to print out the first four dim. fields, then
go to
'the next four, then to the next, etc. within this loop. cnt is the variable
'that we need to use to increment by.
For idxDims = start to (column_count + start - 2)
row.Item(idxDims) = arDimensions(cnt) 'These items come from the
arDimensions array.
cnt = cnt + 1
Next
cnt = 0 'I know that doing this resets the count to zero and causes my
problem, but I can't figure out how to move to the next number without
getting a "column(cnt) cannot be found error.
Next 'idx