The Upgrade Wizard is a tool provided by Microsoft as part of the Visual Studio .NET package, to assist us with migrating existing applications to the .NET Framework. It''s not, as we will see, crammed full of functionality for Crystal Reports.
Let''s go back to the original application we had open before. Go ahead and start up Visual Studio .NET, and select Open Project. Navigate to the folder with the original VB6 project, and open it. We are greeted with the Visual Basic Upgrade Wizard.
Go through the steps, agreeing that you want to create an .EXE (only option) file, and selecting your destination folder. As you watch, keep in mind that all it is doing is rewriting what we just created in the section above. It takes a while doesn''t it? I am on a really fast machine too, so I think I''ll go and check my e-mail.
OK, folks, we''re back. Build the resulting solution. What? Errors?
Crystal8.5Designer.vb(93): Type ''CrystalReport1'' is not defined.
ComplexCrystal8.5Designer.vb(93): Type ''CrystalReport2'' is not defined.
We have a problem. The DSR files that we created with VB6 didn''t convert into anything, and that needs to change.
A dig into the Knowledge Base for Crystal Reports.NET uncovered this interesting piece of information.
Important
A DSR file (from the Report Designer Component) must be manually converted to a standard Crystal Report (RPT) file. To convert a DSR file to a RPT file:
From the VB6 project, load the report by double-clicking the DSR file from the Project window.
Right-click on the report, and from the pop-up menu, select Report | Save to Crystal Reports File.
A quick check finds that Knowledge Base is right. If we drop the DSR files from the project and insert our converted Crystal files, everything does work to some level of satisfaction. To get an eyeful, however, check out the source code from the Crystal8.5Designer.vb file, and all of the linked help files:
''UPGRADE_ISSUE: CrystalReport1 object was not upgraded. Click for more: ''ms- help://MS.VSCC/commoner/redir/redirect?keyword="vbup2068"'' Dim Report As New CrystalReport1 Private Sub Form2_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load ''UPGRADE_WARNING: Screen property Screen.MousePointer has a new behavior. ''Click for more: ''ms-help://MS.VSCC/commoner/redir/redirect?keyword="vbup2065"'' System. Windows .Forms.Cursor.Current=System.Windows.Forms.Cursors.WaitCursor ''UPGRADE_WARNING: Couldn''t resolve default property of object ''CRViewer1.ReportSource. ''Click for more: ''ms-help://MS.VSCC/commoner/redir/redirect?keyword="vbup1037"'' ''UPGRADE_WARNING: Couldn''t resolve default property of object Report. ''Click for more: ''ms-help://MS.VSCC/commoner/redir/redirect?keyword="vbup1037"'' CRViewerl.ReportSource = Report CRViewer1.ViewReport() ''UPGRADE_WARNING: Screen property Screen.MousePointer has a new behavior. ''Click for more: ''ms-help://MS.VSCC/commoner/redir/redirect?keyword="vbup2065"'' System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default End Sub ''UPGRADE_WARNING: Event Form2.Resize may fire when form is intialized. ''Click for more: ''ms-help://MS.VSCC/commoner/redir/redirect?keyword="vbup2075"'' Private Sub Form2_Resize(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Resize CRViewer1.Top = 0 CRViewer1.Left = 0 CRViewerl.Height = ClientRectangle.Height CRViewerl.Width = ClientRectangle.Width End Sub