VB图书管理系统源代码
附录:源代码清单
附1.1主窗体设计代码如下:
Public Class 主窗体
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
‘此处省略主窗体设计代码
#End Region
Dim sender As System.Object
Dim e As System.EventArgs
Public Sub LoadDataSet()
Dim objDataSetTemp As 图书馆管理.Lib管理者信息
objDataSetTemp = New 图书馆管理.Lib管理者信息
'临时数据集objDataSetTemp保存从FillDataSet()函数调用中返回的记录
'如果未出错则填充到主数据集 "objLib管理者信息"中
Try
Me.FillDataSet(objDataSetTemp)
Catch eFillDataSet As System.Exception
Throw eFillDataSet
End Try
Try
objLib管理者信息.Clear()
objLib管理者信息.Merge(objDataSetTemp)
Catch eLoadMerge As System.Exception
Throw eLoadMerge
End Try
End Sub
Public Sub FillDataSet(ByVal dataSet As 图书馆管理.Lib管理者信息)
'实现打开连接,将OleDbDataAdapter1中的数据添加到数据集,关闭连接。
dataSet.EnforceConstraints = False
Try
Me.OleDbConnection1.Open()
Me.OleDbDataAdapter1.Fill(dataSet)
Catch fillException As System.Exception
Throw fillException
Finally
dataSet.EnforceConstraints = True
Me.OleDbConnection1.Close()
End Try
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
End Sub
Private Sub LinkLabel_退出_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel_退出.LinkClicked
End
End Sub
Private Sub LinkLabel_读者信息_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel_读者信息.LinkClicked
btn_读者信息_Click(sender, e)
End Sub
Private Sub LinkLabel_书籍信息_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel_书籍信息.LinkClicked
btn_书籍信息_Click(sender, e)
End Sub
Private Sub 主窗体_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub LinkLabel_出版社信息_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel_出版社信息.LinkClicked
btn_出版社信息_Click(sender, e)
End Sub
Private Sub LinkLabel_借阅信息_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel_借阅信息.LinkClicked
btn_借阅信息_Click(sender, e)
End Sub
Private Sub LinkLabel_查询_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel_查询.LinkClicked
btn_查询_Click(sender, e)
End Sub
Private Sub LinkLabel_报表_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel_报表.LinkClicked
btn_报表_Click(sender, e)
End Sub
Private Sub LinkLabel_管理者信息_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel_管理者信息.LinkClicked
btn_管理者信息_Click(sender, e)
End Sub
Function UserCheck(ByVal sender As System.Object, ByVal e As System.EventArgs) As Boolean
Dim dlg_Login As Login
dlg_Login = New Login
If (dlg_Login.ShowDialog = DialogResult.OK) Then
Try
Me.LoadDataSet()
Catch eLoad As System.Exception
System.Windows.Forms.MessageBox.Show(eLoad.Message)
End Try
Dim i As Integer
Me.BindingContext(objLib管理者信息, "管理者信息").Position = 0
For i = 0 To Me.BindingContext(objLib管理者信息, "管理者信息").Count - 1
If Not Me.BindingContext(objLib管理者信息, "管理者信息").Current.GetType Is GetType(DataRowView) Then
Exit For
End If
Dim drv As DataRowView = CType(Me.BindingContext(objLib管理者信息, "管理者信息").Current, DataRowView)
If Trim(drv("用户名称")) = dlg_Login.Txt_用户姓名.Text Then
If Trim(drv("密码")) = dlg_Login.Txt_用户密码.Text Then
Return True
End If
End If
Me.BindingContext(objLib管理者信息, "管理者信息").Position += 1
Next
End If
UserCheck = False
End Function
Private Sub btn_读者信息_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_读者信息.Click
If UserCheck(sender, e) Then
Dim dlg As 读者信息
dlg = New 读者信息
dlg.ShowDialog()
Else
MessageBox.Show("登录失败!", "登录", MessageBoxButtons.OK, _
MessageBoxIcon.Stop)
End If
End Sub
Private Sub btn_书籍信息_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_书籍信息.Click
If UserCheck(sender, e) Then
Dim dlg As 书籍信息
dlg = New 书籍信息
dlg.ShowDialog()
Else
MessageBox.Show("登录失败!", "登录", MessageBoxButtons.OK, _
MessageBoxIcon.Stop)
End If
End Sub
Private Sub btn_出版社信息_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_出版社信息.Click
If UserCheck(sender, e) Then492
[1] [2] [3] [4] [5] [6] [7] [8] 下一页