Print Page | Close Window

VB.NET 2008 CrystalReports

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=14769
Printed Date: 29 Apr 2024 at 6:04pm


Topic: VB.NET 2008 CrystalReports
Posted By: Manda
Subject: VB.NET 2008 CrystalReports
Date Posted: 24 Oct 2011 at 10:35pm
Hello,

excuse my english its not that good, but I try my best.
I want to make a CrystalReport without using the CrystalReportViewer or any Databases/DataSets.

I have an ObjectList (just like a ListView) which I filled with 10 elements (ID,Name,Description). Now I am trying to export this list to .pdf

Here I am trying to fill the list:


Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click

    Dim itemList As List(Of DataHelper) = New List(Of DataHelper)

    For i As Integer = 1 To 10 Step 1
        itemList.Add(New DataHelper(String.Format("Name {0:00000}", i), String.Format("Desc {0:00000}", i)))
    Next

    m_ObjectListView.AddObjects(itemList)
End Sub


Here I am calling the function:

Private Sub btnPdf_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPdf.Click Dim report As DataFormatter = New DataFormatter report.WriteReportToPDF(m_ObjectListView) End Sub


Here I am trying to export it: And I am stuck here!! Please Help!!

Public Sub WriteReportToPDF(ByVal _list As BrightIdeasSoftware.ObjectListView) Implements IDataFormatter.WriteReportToPDF Dim cr As ReportDocument = New ReportDocument Try cr.SetDataSource(_list) cr.ExportToDisk(ExportFormatType.PortableDocFormat, "Report") Catch ex As Exception ex.Message.ToString(ex) End Try End Sub


I am just a beginner with CrystalReports, so that means I dont have
much experience. The problem ist the "WriteReportToPDF".
Thanks in advance!!!

Greetings
Manda



Print Page | Close Window