Glossary Item Box
This walkthrough is split up into the following activities:
To add a new form and viewer control
To write the code in Visual Basic
To write the code in C#
The following example shows what the code for the method looks like.
' Visual Basic
Public Sub SetReport(ByRef report As DataDynamics.ActiveReports.ActiveReport)
Try
m_rpt = report
Catch ex As Exception
MessageBox.Show("Error: " + ex.Message + "\n" + "Stack:\n" + ex.StackTrace + _
"\n" + ex.Source)
End Try
End Sub
//C#
public void SetReport(DataDynamics.ActiveReports.ActiveReport report)
{
m_rpt = report;
}To write the code in Visual Basic
To write the code in C#
The following example shows what the code for the method looks like.
' Visual Basic
Private Sub showReport(ByRef reportObject As DataDynamics.ActiveReports.ActiveReport)
Try
Dim rpt As New DataDynamics.ActiveReports.ActiveReport()
rpt = reportObject
Me.Viewer1().Document = rpt.Document
rpt.Run()
Catch ex As Exception
MessageBox.Show("Error:\n " + ex.Message + "\nStack:\n" + ex.StackTrace + _
"\nSource:\n" + ex.Source)
End Try
End Sub
//C#
private void showReport(DataDynamics.ActiveReports.ActiveReport report)
{
try
{
DataDynamics.ActiveReports.ActiveReport rpt =
(DataDynamics.ActiveReports.ActiveReport)report;
viewer1.Document = rpt.Document;
rpt.Run();
}
catch(Exception ex)
{
MessageBox.Show("Error:\n " + ex.Message + "\nStack:\n"+ _
ex.StackTrace + "\nSource:\n" + ex.Source);
}
}To write the code in Visual Basic
To write the code in C#
The following example shows what the code for the method looks like.
' Visual Basic
Private Sub frmPrintPreview_Load(ByVal sender As System.Object, ByVal e _
As System.EventArgs) Handles MyBase.Load
If m_rpt Is Nothing = False Then
Me.showReport(m_rpt)
End If
End Sub
//C#
private void frmPrintPreview_Load(object sender, System.EventArgs e)
{
if(m_rpt != null)
{
this.showReport(m_rpt);
}
}| See Also |
Copyright © 2004-2005 Data Dynamics, Ltd. All rights reserved.