Ask a questionAsk a question
 

AnswerCrystal report with Visual Basic 2005 Express Edition

  • Tuesday, January 31, 2006 1:27 PMPDWLC Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     

    Can any one help me to use the crystal report in vb 2005 express edition which doesn't

    have crystal report as the template ?

Answers

  • Monday, November 06, 2006 9:40 AMGaAnpPhiCha Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    The good news:  You can use crystal reports with Visual Basic Express

     

    The Bad news:  There are serious limitations with what you can do!!!!

     

    The details: 

    I am writting an app that creates monthly reports of sales for all customers of a specific type.  I basically runs in batch and spits out a pdf format of a report showing the details for each customers monthly transactions, yearly totals, contanct info etc.  Although I havent finished yet I can create the reports I want with out too much difficulty.  BUT I cant seem to view the reports in a "CrystalReportViewer" object while the program is running and I am assuming this is because CR CAN NOT INTEGRATE with Visual Studio Express as it does with Visual Studio.

    To be able to create reports and then save, export, print or view (by first exporting to pdf then viewing pdf file) this is what I have done -

    Crystal reports does not ship with Visual Studio Express as it does with Visual Studio so you will obviously have to buy the full product from Business Objects which is not all a bad thing because there is more functionality than the Crystal Reports.Net bundled with Visual Studio.

    Now according to Business Objects: in order to use the full version of cystal reports with Visual Studio (they do not mention Express so I assume this actually only refers to Visual Studio but might be important, - I did it and it works) you will need to install Crystal Reports XI Release 2.  It is basically Crystal Reports 11 (XI) but is adapted to work with .Net 2.0 ie Visual Studio 2005.  Its verison number should be 11.5.(something) as apposed to CR XI which is version 11.0 or something close.

     

    Use CR XI R2 to create reports as standard then add the relevant crystal  references to your VB express solution:

    crystaldecisions.crystalreports.engine

    crystaldecisions.reportsource

    crystaldecisions.shared

    crystaldecisions.windows.forms

     

    add your report file to your project and then use the "report object model" (see crystal reference for info) to create a reprt object, load your report, format it, select data to display, export or print or whatever.  Just remember that you cant view it in the crystal report viewer on your windows form or at least I havent been able to figure it out yet.

    Here is some code:

    'Declarations

    Imports CrystalDecisions.CrystalReports.Engine

    Imports CrystalDecisions.Shared

     

    'In Class

    Dim customerReport As ReportDocument

    customerReport = New ReportDocument()

    Dim reportPath As String = Application.StartupPath & "\" & "CustMonthly.rpt"   ' I saved my report in the "\BIN\Debug" dir

    customerReport.Load(reportPath)

    Dim strPath As String

    Dim strFileName As String

    'Filename made up of customer number, year, month

    strFileName = strCust & "_" & intYear.ToString & "_" & intMonthStart.ToString

     'Path to save pdf report to and filename saved as

    strPath = Application.StartupPath & "\reports\" & strFileName & ".pdf"

    customerReport.ExportToDisk(ExportFormatType.PortableDocFormat, strPath)

     

     

    Viola - you have a report in pdf

     

    Now to select or filter data I change the RecordSelectionFormula as so: (You can also use parameters, dataviews/datatables etc)

    customerReport.RecordSelectionFormula = "(({customer.Cust_Number} = '" & strCust & "' AND {auditall.Year} = " & intYear & ") AND ({auditall.Month} >= " & intMonthStart & " and {auditall.Month} <= " & intMonthEnd & ")) "

    This selects records matching strCust, intYear, and in month range defined between intMonthStart and intMonthEnd.

     

    For subreport data filtering etc ("YTD" is name of subreport.)

    customerReport.Subreports("YTD").RecordSelectionFormula = "( {customer.Cust_Number} = '" & strCust & "' AND ({auditall.Period} < 200611 and {auditall.Period} >= 200511 ) )"

     

    I must say that the fact that you cant use a crystal report viewer in my windows forms is really upsetting me but luckily in my case the reports are going to be emailed or printed/faxed from the pdf files so it should work out ok (No jinxes here!)

     

    FYI - I am not a serious developer and am pretty knew to Visual Studio Express and Crystal XI. Last developed Visual Studio.Net and intergrated Crystal in 2002!  I know my solution is not pretty but it is working for my needs.  Hope that helps some people who have been stumped like I have been for way to long.

All Replies

  • Tuesday, January 31, 2006 10:54 PMshakalama Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    hi,

    crystal report is not supported in express edition may you will find it in other editions but not the express one as far as i heard its third party plugins

    hope this helps

  • Monday, November 06, 2006 9:40 AMGaAnpPhiCha Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    The good news:  You can use crystal reports with Visual Basic Express

     

    The Bad news:  There are serious limitations with what you can do!!!!

     

    The details: 

    I am writting an app that creates monthly reports of sales for all customers of a specific type.  I basically runs in batch and spits out a pdf format of a report showing the details for each customers monthly transactions, yearly totals, contanct info etc.  Although I havent finished yet I can create the reports I want with out too much difficulty.  BUT I cant seem to view the reports in a "CrystalReportViewer" object while the program is running and I am assuming this is because CR CAN NOT INTEGRATE with Visual Studio Express as it does with Visual Studio.

    To be able to create reports and then save, export, print or view (by first exporting to pdf then viewing pdf file) this is what I have done -

    Crystal reports does not ship with Visual Studio Express as it does with Visual Studio so you will obviously have to buy the full product from Business Objects which is not all a bad thing because there is more functionality than the Crystal Reports.Net bundled with Visual Studio.

    Now according to Business Objects: in order to use the full version of cystal reports with Visual Studio (they do not mention Express so I assume this actually only refers to Visual Studio but might be important, - I did it and it works) you will need to install Crystal Reports XI Release 2.  It is basically Crystal Reports 11 (XI) but is adapted to work with .Net 2.0 ie Visual Studio 2005.  Its verison number should be 11.5.(something) as apposed to CR XI which is version 11.0 or something close.

     

    Use CR XI R2 to create reports as standard then add the relevant crystal  references to your VB express solution:

    crystaldecisions.crystalreports.engine

    crystaldecisions.reportsource

    crystaldecisions.shared

    crystaldecisions.windows.forms

     

    add your report file to your project and then use the "report object model" (see crystal reference for info) to create a reprt object, load your report, format it, select data to display, export or print or whatever.  Just remember that you cant view it in the crystal report viewer on your windows form or at least I havent been able to figure it out yet.

    Here is some code:

    'Declarations

    Imports CrystalDecisions.CrystalReports.Engine

    Imports CrystalDecisions.Shared

     

    'In Class

    Dim customerReport As ReportDocument

    customerReport = New ReportDocument()

    Dim reportPath As String = Application.StartupPath & "\" & "CustMonthly.rpt"   ' I saved my report in the "\BIN\Debug" dir

    customerReport.Load(reportPath)

    Dim strPath As String

    Dim strFileName As String

    'Filename made up of customer number, year, month

    strFileName = strCust & "_" & intYear.ToString & "_" & intMonthStart.ToString

     'Path to save pdf report to and filename saved as

    strPath = Application.StartupPath & "\reports\" & strFileName & ".pdf"

    customerReport.ExportToDisk(ExportFormatType.PortableDocFormat, strPath)

     

     

    Viola - you have a report in pdf

     

    Now to select or filter data I change the RecordSelectionFormula as so: (You can also use parameters, dataviews/datatables etc)

    customerReport.RecordSelectionFormula = "(({customer.Cust_Number} = '" & strCust & "' AND {auditall.Year} = " & intYear & ") AND ({auditall.Month} >= " & intMonthStart & " and {auditall.Month} <= " & intMonthEnd & ")) "

    This selects records matching strCust, intYear, and in month range defined between intMonthStart and intMonthEnd.

     

    For subreport data filtering etc ("YTD" is name of subreport.)

    customerReport.Subreports("YTD").RecordSelectionFormula = "( {customer.Cust_Number} = '" & strCust & "' AND ({auditall.Period} < 200611 and {auditall.Period} >= 200511 ) )"

     

    I must say that the fact that you cant use a crystal report viewer in my windows forms is really upsetting me but luckily in my case the reports are going to be emailed or printed/faxed from the pdf files so it should work out ok (No jinxes here!)

     

    FYI - I am not a serious developer and am pretty knew to Visual Studio Express and Crystal XI. Last developed Visual Studio.Net and intergrated Crystal in 2002!  I know my solution is not pretty but it is working for my needs.  Hope that helps some people who have been stumped like I have been for way to long.

  • Monday, November 06, 2006 9:44 AMGaAnpPhiCha Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    The good news:  You can use crystal reports with Visual Basic Express

     

    The Bad news:  There are serious limitations with what you can do!!!!

     

    The details: 

    I am writting an app that creates monthly reports of sales for all customers of a specific type.  I basically runs in batch and spits out a pdf format of a report showing the details for each customers monthly transactions, yearly totals, contanct info etc.  Although I havent finished yet I can create the reports I want with out too much difficulty.  BUT I cant seem to view the reports in a "CrystalReportViewer" object while the program is running and I am assuming this is because CR CAN NOT INTEGRATE with Visual Studio Express as it does with Visual Studio.

    To be able to create reports and then save, export, print or view (by first exporting to pdf then viewing pdf file) this is what I have done -

    Crystal reports does not ship with Visual Studio Express as it does with Visual Studio so you will obviously have to buy the full product from Business Objects which is not all a bad thing because there is more functionality than the Crystal Reports.Net bundled with Visual Studio.

    Now according to Business Objects: in order to use the full version of cystal reports with Visual Studio (they do not mention Express so I assume this actually only refers to Visual Studio but might be important, - I did it and it works) you will need to install Crystal Reports XI Release 2.  It is basically Crystal Reports 11 (XI) but is adapted to work with .Net 2.0 ie Visual Studio 2005.  Its verison number should be 11.5.(something) as apposed to CR XI which is version 11.0 or something close.

     

    Use CR XI R2 to create reports as standard then add the relevant crystal  references to your VB express solution:

    crystaldecisions.crystalreports.engine

    crystaldecisions.reportsource

    crystaldecisions.shared

    crystaldecisions.windows.forms

     

    add your report file to your project and then use the "report object model" (see crystal reference for info) to create a reprt object, load your report, format it, select data to display, export or print or whatever.  Just remember that you cant view it in the crystal report viewer on your windows form or at least I havent been able to figure it out yet.

    Here is some code:

    'Declarations

    Imports CrystalDecisions.CrystalReports.Engine

    Imports CrystalDecisions.Shared

     

    'In Class

    Dim customerReport As ReportDocument

    customerReport = New ReportDocument()

    Dim reportPath As String = Application.StartupPath & "\" & "CustMonthly.rpt"   ' I saved my report in the "\BIN\Debug" dir

    customerReport.Load(reportPath)

    Dim strPath As String

    Dim strFileName As String

    'Filename made up of customer number, year, month

    strFileName = strCust & "_" & intYear.ToString & "_" & intMonthStart.ToString

     'Path to save pdf report to and filename saved as

    strPath = Application.StartupPath & "\reports\" & strFileName & ".pdf"

    customerReport.ExportToDisk(ExportFormatType.PortableDocFormat, strPath)

     

     

    Viola - you have a report in pdf

     

    Now to select or filter data I change the RecordSelectionFormula as so: (You can also use parameters, dataviews/datatables etc)

    customerReport.RecordSelectionFormula = "(({customer.Cust_Number} = '" & strCust & "' AND {auditall.Year} = " & intYear & ") AND ({auditall.Month} >= " & intMonthStart & " and {auditall.Month} <= " & intMonthEnd & ")) "

    This selects records matching strCust, intYear, and in month range defined between intMonthStart and intMonthEnd.

     

    For subreport data filtering etc ("YTD" is name of subreport.)

    customerReport.Subreports("YTD").RecordSelectionFormula = "( {customer.Cust_Number} = '" & strCust & "' AND ({auditall.Period} < 200611 and {auditall.Period} >= 200511 ) )"

     

    I must say that the fact that you cant use a crystal report viewer in my windows forms is really upsetting me but luckily in my case the reports are going to be emailed or printed/faxed from the pdf files so it should work out ok (No jinxes here!)

     

    FYI - I am not a serious developer and am pretty knew to Visual Studio Express and Crystal XI. Last developed Visual Studio.Net and intergrated Crystal in 2002!  I know my solution is not pretty but it is working for my needs.  Hope that helps some people who have been stumped like I have been for way to long.

  • Wednesday, November 21, 2007 7:19 AMerine Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    is the code a web based application?? I'm having difficulty in figuring out how to program a crystal report in vb.net cause i haven't tried it not until now... there are certain problems like the log-in problem to the dataset... and the databinding...  pls help me resolve my problem... I just want to display the fields on my table but sad to say, i was unable to do so...

  • Sunday, January 27, 2008 9:18 AMaytas Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I am facing the same problem ,How to use the crystal report in vs 2005 express edition.There is no crystal report to add as a new item.Did you got any solution?

  • Wednesday, April 30, 2008 10:09 AMGijs_10 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals