📄 frm_receiptviewer.vb
字号:
'****************************************************************************
'人人为我,我为人人
'枕善居汉化收藏整理
'发布日期:2007/07/23
'描 述:图书管理系统
'网 站:http://www.Mndsoft.com/ (VB6源码博客)
'网 站:http://www.VbDnet.com/ (VB.NET源码博客,主要基于.NET2005)
'e-mail :Mndsoft@163.com
'e-mail :Mndsoft@126.com
'OICQ :88382850
' 如果您有新的好的代码别忘记给枕善居哦!
'****************************************************************************
Imports System.Data.OleDb
Public Class frm_ReceiptViewer
Inherits System.Windows.Forms.Form
Dim MyConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\Library.mdb")
Dim MyCommand
Dim e As Exception
Dim MyCommand2
Dim MyReader As OleDbDataReader
Dim MyReader2 As OleDbDataReader
Dim dbset As New DataSet
Dim dataA
Dim myreport = New rep_IssueReceipt
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
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
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents CrystalReportViewer1 As CrystalDecisions.Windows.Forms.CrystalReportViewer
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TxtReceiptNo As System.Windows.Forms.TextBox
Friend WithEvents BtnShow As System.Windows.Forms.Button
Friend WithEvents BtnPrint As System.Windows.Forms.Button
Friend WithEvents BtnClose As System.Windows.Forms.Button
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frm_ReceiptViewer))
Me.CrystalReportViewer1 = New CrystalDecisions.Windows.Forms.CrystalReportViewer
Me.Label1 = New System.Windows.Forms.Label
Me.TxtReceiptNo = New System.Windows.Forms.TextBox
Me.BtnShow = New System.Windows.Forms.Button
Me.BtnPrint = New System.Windows.Forms.Button
Me.BtnClose = New System.Windows.Forms.Button
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.SuspendLayout()
'
'CrystalReportViewer1
'
Me.CrystalReportViewer1.ActiveViewIndex = -1
Me.CrystalReportViewer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.CrystalReportViewer1.DisplayGroupTree = False
Me.CrystalReportViewer1.DisplayToolbar = False
Me.CrystalReportViewer1.Location = New System.Drawing.Point(12, 39)
Me.CrystalReportViewer1.Name = "CrystalReportViewer1"
Me.CrystalReportViewer1.SelectionFormula = ""
Me.CrystalReportViewer1.ShowCloseButton = False
Me.CrystalReportViewer1.ShowExportButton = False
Me.CrystalReportViewer1.ShowGotoPageButton = False
Me.CrystalReportViewer1.ShowGroupTreeButton = False
Me.CrystalReportViewer1.ShowPageNavigateButtons = False
Me.CrystalReportViewer1.ShowPrintButton = False
Me.CrystalReportViewer1.ShowRefreshButton = False
Me.CrystalReportViewer1.ShowTextSearchButton = False
Me.CrystalReportViewer1.ShowZoomButton = False
Me.CrystalReportViewer1.Size = New System.Drawing.Size(686, 405)
Me.CrystalReportViewer1.TabIndex = 0
Me.CrystalReportViewer1.ViewTimeSelectionFormula = ""
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(259, 12)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(120, 24)
Me.Label1.TabIndex = 1
Me.Label1.Text = "借阅条编号"
'
'TxtReceiptNo
'
Me.TxtReceiptNo.Location = New System.Drawing.Point(394, 9)
Me.TxtReceiptNo.Name = "TxtReceiptNo"
Me.TxtReceiptNo.Size = New System.Drawing.Size(163, 21)
Me.TxtReceiptNo.TabIndex = 2
'
'BtnShow
'
Me.BtnShow.Location = New System.Drawing.Point(52, 460)
Me.BtnShow.Name = "BtnShow"
Me.BtnShow.Size = New System.Drawing.Size(144, 24)
Me.BtnShow.TabIndex = 3
Me.BtnShow.Text = "显示借阅条"
'
'BtnPrint
'
Me.BtnPrint.Location = New System.Drawing.Point(272, 460)
Me.BtnPrint.Name = "BtnPrint"
Me.BtnPrint.Size = New System.Drawing.Size(155, 24)
Me.BtnPrint.TabIndex = 4
Me.BtnPrint.Text = "打印"
'
'BtnClose
'
Me.BtnClose.Location = New System.Drawing.Point(503, 460)
Me.BtnClose.Name = "BtnClose"
Me.BtnClose.Size = New System.Drawing.Size(154, 24)
Me.BtnClose.TabIndex = 5
Me.BtnClose.Text = "关闭"
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(1075, 250)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(120, 21)
Me.TextBox2.TabIndex = 6
Me.TextBox2.Visible = False
'
'frm_ReceiptViewer
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(710, 506)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.BtnClose)
Me.Controls.Add(Me.BtnPrint)
Me.Controls.Add(Me.BtnShow)
Me.Controls.Add(Me.TxtReceiptNo)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.CrystalReportViewer1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frm_ReceiptViewer"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "打印借阅条"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
Private Sub BtnShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnShow.Click
If TxtReceiptNo.Text = "" Or checkIfAlreadyExists() = False Then
MsgBox("请输入借阅条号码", MsgBoxStyle.Information, "图书馆管理系统")
Else
myreport.Refresh()
myreport.RecordSelectionFormula = "{IssueBook.IssueNo} = '" & TxtReceiptNo.Text & "' "
CrystalReportViewer1.ReportSource = myreport
End If
End Sub
Function checkIfAlreadyExists() As Boolean
MyConnection.Open()
MyCommand = New OleDbCommand("SELECT * FROM IssueBook WHERE IssueNo ='" & TxtReceiptNo.Text & "'", MyConnection)
MyReader = MyCommand.ExecuteReader()
While MyReader.Read
TextBox2.Text = MyReader("IssueNo")
End While
MyConnection.Close()
MyReader.Close()
MyCommand.dispose()
If TxtReceiptNo.Text = TextBox2.Text Then
Return True
Else
If TxtReceiptNo.Text <> TextBox2.Text Then
Return False
End If
End If
End Function
Private Sub BtnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPrint.Click
If TxtReceiptNo.Text = "" Or checkIfAlreadyExists() = False Then
MsgBox("请输入借阅条号码", MsgBoxStyle.Information, "图书馆管理系统")
Else
CrystalReportViewer1.PrintReport()
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnClose.Click
Me.Close()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -