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
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)