Migrating Applications from the Crystal Report Designer Component to the .Net assemblies (VS 2005)

Greetings,

I created many reports using the RDC as an add-in to Visual Basic version 6.0.   Now I'd like to recreate those reports using the CR .Net assemblies and VB 2005.

I used the Visual Studio upgrade wizard to attempt this conversion but I'm not out of the woods yet.  Apparently the wizard can't make all the changes.  I need to get rid of everything in my code that makes use of craxdrt.dll or crviewer.dll.

These are the only errors I'm getting presently and I'm sure these errors will identify the kinds of changes I need.

Error:  Name 'CRViewer11' is not declared.
Error:  Type 'CRAXDRT.Sections' is not defined
Error:  Type 'CRAXDRT.Database' is not defined
Error:  'ReportViewer1' is not a member of 'Project1.Form2'
Error:  Type AxCrystalActiveXReportViewerLib11_5._ICRViewerEvents_PrintButtonClickedEvent is not defined
Error:  Type AxCrystalActiveXReportViewerLib11_5._ICRViewerEvents_RefreshButtonClickedEvent is not defined

I've attached the declarations of the module and the primary function of the Form along with attempted changes.

Thanks for the help!
Module
 
    Dim ConnectString, Query As String
    Public param2 As CrystalDecisions.Shared.ParameterField
    Public ADOcn1 As New ADODB.Connection
    Public ADOConnect1 As New ADODB.Recordset       // old method
    Public ADOConnect2 As DataSet = New DataSet()   // new method ??
    Public crDatabase As CRAXDRT.Database           // old method
 
Form1
 
 
 Public Sub displayReport(ByRef param As String)
 
        Dim paramDiscreteValue As New CrystalDecisions.Shared.ParameterDiscreteValue()
        Dim paramValues As New CrystalDecisions.Shared.ParameterValues
 
        
        'Call CreateRecordsets()   // not sure how to replace
 
        param2 = Form1.Report.ParameterFields(0)
        ' Clear the current value
        param2.CurrentValues.Clear()
        ' Set param 2 to a new String value
        paramDiscreteValue.Value = param
        paramValues.Add(paramDiscreteValue)
        param2.CurrentValues.Add(paramValues.Item(0))
 
        
        Form1.Report.Database.Tables.Item(1).SetDataSource(ADOConnect2)  // changes yes/no?
        Me.Show()
        Me.Enabled = True
        CRViewer11.ReportSource = Form1.Report   // error on CRViewer11
        CRViewer11.ViewReport()                  // error on CRViewer11
    End Sub

Open in new window

John500Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
I don't use .Net buit you need to add the Crystal.Net assemblies to your project.

mlmcc
0
John500Author Commented:
.Net assemblies were added to the project by removing the old viewer and adding in the new
0
Bob LearnedCommented:
Did you know that there is reporting services functionality in VB.NET 2005, that doesn't require Crystal Reports or any ActiveX components?

Applied MS Reporting Services 101 using Smart Client
http://www.codeproject.com/KB/reporting-services/rswin101.aspx

Bob
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

John500Author Commented:
Bob,

Nice of you to drop in.  I did noticed the MS Reporting Services.  I guess from a learning curve perspective I figured there would be less going CR.

Any thoughts?  Thanks
0
Bob LearnedCommented:
With that said and out of the way, are you still using ADO classic for database access?  What version is the reference for Crystal?  Does the form designer file have the reference for the CRViewer11?

Bob
0
John500Author Commented:
>> are you still using ADO classic for database access?

I'm in the process of trying to understand just what the impacts are of migrating to the .Net Assemblies.  I have no problem with using the CR .Net Assemblies.  

The project so far has been upgraded using the VS 2005 wizard.  From there I deleted the old viewer and replaced it with the new.  This automatically updated my references but maybe not all of them.

The project consists of two forms and a module.  The first form takes a parameter, the second form shows the viewer and the module makes a connection to an MSSQL database (2005).

I have attached four files (Form1, Form2, module & pic of my references).  If you take a look, you will probably agree I'm not far from the goal.
Form1.txt
Form2.txt
Module1.txt
references.JPG
0
John500Author Commented:
... Any occurrance of the variable 'ADOFail2' in the module should be ADOConnect2
0
Bob LearnedCommented:
If you are not talking about a complicated process, I would go through the process of learning the .NET way, and re-engineering, instead of migrating from the old process.  The new process can use either a strong-typed DataSet, or internal .NET business object classes to provide the input for the reports.

Bob
0
John500Author Commented:
When you look at this project do you see the conversion steps or how you would proceed starting from scratch?  If so, what are these steps?

My ideal solution here would be to receive the steps and necessary code using this project as a basis for conversion.  I can post this question a couple of times to restart the points counter if necessary.

Thanks
0
Bob LearnedCommented:
>>do you see the conversion steps

This is the first thing that I saw when I opened Form1.vb:

Dim par As String
par = VB6.GetItemString(List1, List1.SelectedIndex)

VB.NET:
Dim par As String = List1.SelectedItem.ToString()

Bob
0
John500Author Commented:
Ok, done.

I'm ready for any all changes.
0
Bob LearnedCommented:
I attached a document that describes the steps to create a .NET Crystal Report, with a typed DataSet as the source, which is connected to the AdventureWorks SQL Server sample database.

Bob
Sample-Crystal-Reports-Applicati.doc
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
John500Author Commented:
Bob,

Looks like a good reference.  Thanks.

Regarding the change below:

Dim par As String
par = VB6.GetItemString(List1, List1.SelectedIndex)

VB.NET:
Dim par As String = List1.SelectedItem.ToString()

... that worked also.

I shouldn't have any more questions but let me see if I can get this thing to work.


0
John500Author Commented:
Thanks again
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.