📄 frmprint.vb
字号:
Imports CrystalDecisions.CrystalReports.Engine
Imports System.Windows.Forms
Public Class frmPrint
Inherits System.Windows.Forms.Form
Private RepNam As String
Private SQL As String
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents crvMain As CrystalDecisions.Windows.Forms.CrystalReportViewer
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.crvMain = New CrystalDecisions.Windows.Forms.CrystalReportViewer
Me.SuspendLayout()
'
'crvMain
'
Me.crvMain.ActiveViewIndex = -1
Me.crvMain.Dock = System.Windows.Forms.DockStyle.Fill
Me.crvMain.Location = New System.Drawing.Point(0, 0)
Me.crvMain.Name = "crvMain"
Me.crvMain.ReportSource = Nothing
Me.crvMain.Size = New System.Drawing.Size(872, 534)
Me.crvMain.TabIndex = 0
'
'frmPrint
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(872, 534)
Me.Controls.Add(Me.crvMain)
Me.Name = "frmPrint"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "打印报表"
Me.ResumeLayout(False)
End Sub
#End Region
Sub New(ByVal ReportName As String, ByVal strSQL As String)
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
RepNam = ReportName
SQL = strSQL
End Sub
Private Sub frmPrint_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim myObd As New SCMDB.SCMDB
Try
Dim myRpd As ReportDocument = New ReportDocument
Select Case RepNam
'myRpd报表文件加载Crystal Report的路径设置
Case "ProductList"
myRpd.Load(Application.StartupPath & "\..\..\" & _
"SCMAPP\ProductListReport.rpt")
Case "SupplierList"
myRpd.Load(Application.StartupPath & "\..\..\" & _
"SCMAPP\SupplierListReport.rpt")
Case "PurchaseProduct"
myRpd.Load(Application.StartupPath & "\..\..\" & _
"SCMAPP\PurListReport.rpt")
Case "SaleProduct"
myRpd.Load(Application.StartupPath & "\..\..\" & _
"SCMAPP\SalListReport.rpt")
Case "DamList"
myRpd.Load(Application.StartupPath & "\..\..\" & _
"SCMAPP\DamListReport.rpt")
End Select
'设置报表的数据源
myRpd.SetDataSource(myObd.CreateDataTableBySQL(SQL))
'设置显示的报表文件
Me.crvMain.ReportSource = myRpd
Catch ex As Exception
MsgBox("数据报表显示失败!失败原因:" & ex.Message, _
MsgBoxStyle.Exclamation)
Me.Close()
Exit Sub
End Try
End Sub
Private Sub crvMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles crvMain.Load
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -