Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Heres what happen... I create an app using vb.net that creates ID Card with picture and little details such as ID Picture, Barcode and Name... In my project I use a Windows XP machine... It runs very well... then I start to create a setup file.. I try it first here in my Windows XP so I install it here.. When I open the .exe file and start printing ID Card... It runs smoothly ... Then I deploy it now on a Windows 7 Machine... I install everything needed... the system runs very well... but the opening of the of ID Card form was so slow... it takes almost 5mins to show the ID Card form with crystal report viewer .... I dont know what happen here because there is no wrong with the code... I dont know the reason why it should take a very long time to open it ... I try some tutorials they said that it should run a dummy crystal report viewer so the CRengine will run... I try it but I got the same result.. still slow..

here's the code



VB
Dim CR As New ReportDocument
        CR.Load(Application.StartupPath + "\IDcr.rpt")
        '
        ' Declare the parameter related objects.
        '
        Dim crParameterDiscreteValue As ParameterDiscreteValue
        Dim crParameterFieldDefinitions As ParameterFieldDefinitions
        Dim crParameterFieldLocation As ParameterFieldDefinition
        Dim crParameterValues As ParameterValues
        '
        ' Get the report's parameters collection.
        DirectCast(CR.ReportDefinition.ReportObjects("Text9"), TextObject).Text = txtName.Text
        DirectCast(CR.ReportDefinition.ReportObjects("Text11"), TextObject).Text = txtAddress.Text
        DirectCast(CR.ReportDefinition.ReportObjects("Text12"), TextObject).Text = txtBarcode.Text
        '
        crParameterFieldDefinitions = CR.DataDefinition.ParameterFields
        '
        ' Set the first parameter
        ' - Get the parameter, tell it to use the current values vs default value.
        ' - Tell it the parameter contains 1 discrete value vs multiple values.
        ' - Set the parameter's value.
        ' - Add it and apply it.
        ' - Repeat these statements for each parameter.
        '
        crParameterFieldLocation = crParameterFieldDefinitions.Item("MemPic")
        crParameterValues = crParameterFieldLocation.CurrentValues
        crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
        crParameterDiscreteValue.Value = txtSID.Text
        crParameterValues.Add(crParameterDiscreteValue)
        crParameterFieldLocation.ApplyCurrentValues(crParameterValues)
        '
        ' Set the Crytal Report Viewer control's source to the report document.
        '
        frmPrintID.CrystalReportViewer1.ReportSource = CR

       
        frmPrintID.Show()
        
        Me.Close()
Posted

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900