Printing the contents of three ListBoxes in a single Report

I was wondering if it possible to print the data listed in multiple ListBoxes in one Report? I have three Listboxes that all contain different data, and I want to display the data from all three Listboxes in a single report side-by-side.

Using the ListBoxReport example project the code for printing a ListBox is the following code:

[code]Dim ps As New PrinterSetup

Dim rpt As New NameReport
If ps.PageSetupDialog Then
Dim g As Graphics
g = OpenPrinterDialog(ps)
If g <> Nil Then
If rpt.Run(PrintableListBox, ps) Then
If rpt.Document <> Nil Then
End If
End If
End If
End If[/code]

I was wondering if you have PrintableListBox1, PrintableListBox2, and PrintableListBox3 if they can be loaded into a single report.

Any help would be very much appreciated.

Can you please give a brief overview of the contents/structure of the Listboxes? Does everyone have the same number of columns? Then I can say more about it.

Hi Martin,

Thank you for your response. Each ListBox has five fields each. They all have the same field column names too.

Chapter Total Correct Incorrect Unanswered

The reason there are three different ListBoxes is that each list a different range of test scores, so I want them separated.

So one Listbox would be labeled Poor, the next Average, and the last Proficient.

So, I wanted to use the ListBoxReport example to be able to print the three Listbox contents on the one report. I just don’t know how the code can be modified to do that if it can at all.

I created a Demo-Project for you. You’ll find three ListBoxes with your columns and a Print Button. Clicking the Button creates a temporary In-Memory SQLite-Database for the Report.
You do not need the DataSet-Interface!

I don’t think it is going to work the way I wanted it to, so I decided to create a new ListBox and try to copy the contents of the 3 Listboxes over to that ListBox, so that the first row of each of the 3 Listboxes is on the first row of the newly created one. The problem is I can’t seem to figure out how to put things in the correct spot. I tried the code below and it does not work right

List1.Cell(-1, -1) =Table1.Cell(-1, -1) + Table2.Cell(-1, -1) + Table3.Cell(-1, -1)

If anyone has any ideas how I can do this, I would appreciate any help.

I just realized Martin just posted something, so I will check that out

Isn‘t there an EndOfLine missing after each +? Otherwise the first line of the next table is added to the last line of the previous table, not appended to the table.

Thank you Martin for taking the time to help me!! I very much appreciate it. I think that code will work great. I will try to implement it tomorrow morning when I’m back at work at this.

Thanks again for all your efforts. This code that you wrote will help firefighters understand their weaknesses when it comes to questions in our study software. Better trained firefighters helps save more lives and property.

quote=386488:@Markus Winter]Isn‘t there an EndOfLine missing after each +.[/quote]

I want them to be on the same line but in the correct cells. Table 1 in the first 5 cells, Table 2 in the next five cells, and Table3 in the last 5 cells.

You’re welcome. :wink:

I want them to be on the same line but in the correct cells. Table 1 in the first 5 cells, Table 2 in the next five cells, and Table3 in the last 5 cells.[/quote]

You are missing the point. Read again what I wrote and think about it.

The code…

[quote]Dim cr As String
cr = EndOfLine.Unix
List1.Cell(-1, -1) =Table1.Cell(-1, -1) + cr + Table2.Cell(-1, -1) + cr + Table3.Cell([/quote]

… puts the contents of each ListBox underneath each other in the first 5 cells in the row. I looking to have the contents of all three ListBoxes listed in a single row.

Ah, then I missed the point. My apologies.

No apologies needed. I very much appreciate you trying to help me.