Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am configuring a windows application but i am suffering from an error at Design part of a Form .

My Environment -

Visual studio 2012 Crystal Reports XI AxCRviewer control

this error exist on only one form where i am using crystal report I am giving design side code

Option Strict Off
Option Explicit On

VB
Imports CRAXDDRT
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Namespace Forms.ReportForms
    Friend Class frmReport
        Inherits Form
        Public ReportID As Integer
        Public ReportFile As String
        Public FromGrade As Integer
        Public ToGrade As Integer
        Public isAR As Boolean
        Sub SetViewer()
            'CRViewer.Top = 0
            'CRViewer.Left = 0
            'CRViewer.Width = Me.Width
            'CRViewer.Height = Me.Height
        End Sub

        Private Sub frmReport_Load(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles MyBase.Load
            Dim cryRpt As New ReportDocument
            Dim crtableLogoninfos As New TableLogOnInfos
            Dim crtableLogoninfo As New TableLogOnInfo
            Dim crConnectionInfo As New ConnectionInfo
            Dim CrTables As Tables
            Dim CrTable As Table
            Try
                cryRpt.Load(ReportFile)

                With crConnectionInfo
                    .ServerName = "learnaid"
                    .DatabaseName = Config.DatabaseName
                    .UserID = Config.DbUserID
                    .Password = Config.DbPassword
                End With

                CrTables = cryRpt.Database.Tables
                For Each CrTable In CrTables
                    crtableLogoninfo = CrTable.LogOnInfo
                    crtableLogoninfo.ConnectionInfo = crConnectionInfo
                    CrTable.ApplyLogOnInfo(crtableLogoninfo)
                Next
                cryRpt.SetParameterValue(1, Me.ReportID)
                If Me.FromGrade > 0 Or isAR = True Then
                    cryRpt.SetParameterValue(2, Me.FromGrade)
                    cryRpt.SetParameterValue(3, Me.ToGrade)
                End If
                AxCRViewer1.ReportSource = cryRpt
                AxCRViewer1.Refresh()
            Catch ex As Exception
                MessageBox.Show("Error: " + ex.Message)
            End Try



        End Sub

        'UPGRADE_WARNING: Event frmReport.Resize may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
        Private Sub frmReport_Resize(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles MyBase.Resize
            SetViewer()
        End Sub

        Private Sub frmReport_FormClosed(ByVal eventSender As Object, ByVal eventArgs As FormClosedEventArgs) _
            Handles Me.FormClosed
        End Sub
    End Class
End Namespace
Posted

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