Hello,
I hope I'm posting this problem in the right forum. I'm coding with VB.net, trying to create a Crystal Report (CR) from a class object.
I'm trying to create an order confirmation report with CR. The data is stored into a class object of type OrderItem. An order item has, beside order specific data, a list of LineItem. A line item has, beside order line specific data, a list of SubLineItem. Sub lines have only sub line specific data.
Ex.
Class OrderItem
Private OrderNumber As String
Private OrderLines As List(of LineItem)
End Class
Class LineItem
Private LineNumber As String
Private SubLines As List(of SubLineItem)
End Class
Class SubLineItem
Private SubLineNumber As String
End Class
First I add a CR-item to my project and set the data source to the .Net Object of OrderItem. Here I encounter the first problem, I cannot access the variable containing the list of line items. Why is that? I read somewhere that the class OrderItem should inherit from CollectionBase and I have added that code but I still cannot access the variable. I have also tried to add the LineItem-class separately but then I get an error telling me that I have multiple data sources.
My second problem is related to the creation of a specific PDF from the CR. So far I only got the following code and dont know what is missing:
Dim myReport As New ReportDocument
myReport.Load("C:\OrderConfirmationReport.rpt")
myReport.SetDataSource(myOrder)
Please help me with my problems:
- How do I access my variable containing my list of LineItems (and hopefully the list of SubLineItems in the LineItems)?
- What code is missing to create a pdf of the order (myOrder) I'm setting as data source.