Data Connectivity
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Data Connectivity
Message Icon Topic: Using .net object as data source. Post Reply Post New Topic
Author Message
rpuelma
Newbie
Newbie


Joined: 14 Jun 2010
Online Status: Offline
Posts: 1
Quote rpuelma Replybullet Topic: Using .net object as data source.
    Posted: 14 Jun 2010 at 3:46am
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.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.015 seconds.