Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incrementing Numbers Alternatively... 1

Status
Not open for further replies.

gazal

Programmer
Apr 30, 2003
212
OM
hi
i m stuck with a very typical problem, i am using a class (which i downloaded from psc) for printing labels. One page contains 12 labels (6 on right 6 on left).
The class has got parameters for Row and Column, which makes the class understand where exactly it has to print...

but now my problem is that it restricts me to print only 12 records at a time. Because i have to explicity specify the row and column arguments, here is the code, in which first two arguments are Row and Column.
as u can see in the code, the row and the column values are incrementing alternatively.

for the first record the row and column both are 1, where as for the second record the row is still 1 but the column has become 2, same way when it reaches third record the row becomes 2 but the column is 1....

objLabel.LabelPrint 1, 1, SubArray(1, 0) objLabel.LabelPrint 1, 2, SubArray(2, 0) objLabel.LabelPrint 2, 1, SubArray(3, 0) objLabel.LabelPrint 2, 2, SubArray(4, 0) objLabel.LabelPrint 3, 1, SubArray(5, 0) objLabel.LabelPrint 3, 2, SubArray(6, 0) objLabel.LabelPrint 4, 1, SubArray(7, 0) objLabel.LabelPrint 4, 2, SubArray(8, 0) objLabel.LabelPrint 5, 1, SubArray(9, 0) objLabel.LabelPrint 5, 2, SubArray(10, 0) objLabel.LabelPrint 6, 1, SubArray(11, 0) objLabel.LabelPrint 6, 2, SubArray(12, 0)

My question is how do i automate this process irrespective of no. of records it should print correctly. Is there any mechanism which can fit for such kind of incrementation, or may be some array matrix???

please help...

Thanks


Gazal
 
Looks like nested For..Next loops to me. Something like:
[tt]

For lngRow = 1 to 6
For lngCol = 1 to 2
objLabel.LabelPrint lngCol, lngRow, SubArray(lngCol + (2 * (lngRow - 1)), 0)
Next lngCol
NextlngRow
[/tt]

Just change the loop limit values as you need them

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Hi John

Thanks a lot man, that was a great help... thanks, such a small piece of code but did the trick for me...

Thanks again

Gazal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top