Printing a DesktopListBox

I have created a class based on printer setup.

I pass a DesktopListBox into the class so that I can loop through the records and print them using the graphics from ShowPrinterDialog.

The DesktopListBox can contain in the order of 10,000 rows.

Printing works fine when I print only one page of rows but with a large quantity of pages it does not obtain the row data correctly. In fact it does not obtain the data at all.

When looping through the DesktopListBox rows if I use myListBox.ScrollPosition = n (loop index) before obtaining the row data then the data is returned correctly even for 10,000 rows.

Can someone point me in the right direction please.

Thanks

Terry

What code do you perform in the list box mousewheel event and the cell paint events?

Nothing in the mousewheel event

PaintCellBackground

If Not Me.RowSelectedAt(row) Then
If Color.IsDarkMode Then
g.ClearRectangle(0.0, 0.0, g.Width, g.Height)
End If
If row Mod 2 = 1 Then
g.DrawingColor = ColorGroup.NamedColor(“secondaryContentBackgroundColor”)
g.FillRectangle(0.0, 0.0, g.Width, g.Height)
End If
Return True
End If

PaintCellText

me.CellTextAt(row,column) = me.CellTagAt(row,column)

Found it, thanks for the pointer.

me.CellTextAt(row,column) = me.CellTagAt(row,column)

This is the culprit.

I have modified my printing class to accommodate both CellTextAt and CellTagAt

Thanks again