⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addduzhe.frm

📁 这是用VB做的一个很完善的图书管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form addduzhe 
   Caption         =   "添加读者"
   ClientHeight    =   3870
   ClientLeft      =   4140
   ClientTop       =   2475
   ClientWidth     =   7290
   Icon            =   "addduzhe.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3870
   ScaleWidth      =   7290
   Begin VB.CommandButton Command2 
      Caption         =   "关    闭"
      Height          =   735
      Left            =   4178
      TabIndex        =   19
      Top             =   3015
      Width           =   1695
   End
   Begin VB.CommandButton Command1 
      Caption         =   "保    存"
      Height          =   735
      Left            =   1418
      TabIndex        =   18
      Top             =   3015
      Width           =   1695
   End
   Begin VB.Frame Frame1 
      Caption         =   "读者管理"
      Height          =   2775
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   7095
      Begin VB.ComboBox Combo2 
         Height          =   300
         Left            =   1200
         TabIndex        =   4
         Text            =   "教师"
         Top             =   1800
         Width           =   2175
      End
      Begin VB.ComboBox Combo1 
         Height          =   300
         IMEMode         =   3  'DISABLE
         ItemData        =   "addduzhe.frx":0E42
         Left            =   1200
         List            =   "addduzhe.frx":0E44
         TabIndex        =   3
         Text            =   "男"
         Top             =   1320
         Width           =   2175
      End
      Begin VB.TextBox Text4 
         Height          =   270
         Left            =   4560
         TabIndex        =   6
         Top             =   360
         Width           =   2295
      End
      Begin VB.TextBox Text3 
         Height          =   270
         Left            =   1200
         TabIndex        =   5
         Top             =   2280
         Width           =   2175
      End
      Begin VB.TextBox Text2 
         Height          =   270
         Left            =   1200
         TabIndex        =   2
         Top             =   840
         Width           =   2175
      End
      Begin VB.TextBox Text1 
         Height          =   270
         Left            =   1200
         TabIndex        =   1
         Top             =   360
         Width           =   2175
      End
      Begin VB.TextBox Text6 
         Height          =   1215
         Left            =   4560
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   8
         Top             =   1440
         Width           =   2295
      End
      Begin VB.TextBox Text5 
         Height          =   270
         Left            =   4560
         TabIndex        =   7
         Top             =   840
         Width           =   2295
      End
      Begin VB.Label Label9 
         Caption         =   "(50字以内)"
         ForeColor       =   &H000000FF&
         Height          =   255
         Left            =   3480
         TabIndex        =   17
         Top             =   1560
         Width           =   1095
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "类    别:"
         Height          =   180
         Left            =   240
         TabIndex        =   16
         Top             =   1850
         Width           =   900
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "性    别:"
         Height          =   180
         Left            =   240
         TabIndex        =   15
         Top             =   1400
         Width           =   900
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "姓    名:"
         Height          =   180
         Left            =   240
         TabIndex        =   14
         Top             =   900
         Width           =   900
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "读者编号:"
         Height          =   180
         Left            =   240
         TabIndex        =   13
         Top             =   420
         Width           =   900
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         Caption         =   "备    注:"
         Height          =   180
         Left            =   3600
         TabIndex        =   12
         Top             =   1400
         Width           =   900
      End
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         Caption         =   "单位部门:"
         Height          =   180
         Left            =   3600
         TabIndex        =   11
         Top             =   900
         Width           =   900
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "住    址:"
         Height          =   180
         Left            =   3600
         TabIndex        =   10
         Top             =   400
         Width           =   900
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "联系电话:"
         Height          =   180
         Left            =   240
         TabIndex        =   9
         Top             =   2330
         Width           =   900
      End
   End
End
Attribute VB_Name = "addduzhe"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim addduzhecn As New ADODB.Connection
Dim addduzhersuser As New ADODB.Recordset
Dim addduzhersuser1 As New ADODB.Recordset
Private Sub Combo1_KeyUp(KeyCode As Integer, Shift As Integer)
Combo1.Text = ""
End Sub
Private Sub Combo2_KeyUp(KeyCode As Integer, Shift As Integer)
Combo2.Text = ""
End Sub

Private Sub Command1_Click()
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Or Combo1.Text = "" Or Combo2.Text = "" Then
   nul = MsgBox("每一项都必须填写!", vbOKOnly + vbExclamation, "错误:")
Else
    If Len(Text6.Text) <= 50 Then
       addduzhersuser.AddNew
       addduzhersuser("编号") = Text1.Text
       addduzhersuser("姓名") = Text2.Text
       addduzhersuser("性别") = Combo1.Text
       addduzhersuser("类别") = Combo2.Text
       addduzhersuser("联系电话") = Text3.Text
       addduzhersuser("住址") = Text4.Text
       addduzhersuser("单位部门") = Text5.Text
       addduzhersuser("备注") = Text6.Text
       
       addduzhersuser1.MoveFirst
       For i = 0 To addduzhersuser1.RecordCount
         If Combo2.Text = addduzhersuser1(0) Then
          addduzhersuser("可借书数") = addduzhersuser1(2)
          addduzhersuser("借书期限") = addduzhersuser1(1)
         End If
       Next i
       
       addduzhersuser("登记日期") = Date
       addduzhersuser.UpdateBatch adAffectAllChapters
       nul = MsgBox("记录添加成功!", vbOKOnly + vbInformation, "揭示:")
       Text1.Text = ""
       Text2.Text = ""
       Text3.Text = ""
       Text4.Text = ""
       Text5.Text = ""
       Text6.Text = ""
    Else
       nul = MsgBox("备注字段不能超过50个字!", vbOKOnly + vbExclamation, "错误:")
    End If
End If
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
Set addduzhecn = New Connection
    addduzhecn.ConnectionString = "provider=Microsoft.Jet.OLEDB.3.51;data source=book.mdb;"
    addduzhecn.CursorLocation = adUseClient
    addduzhecn.Open
    Set addduzhersuser = New Recordset
    addduzhersuser.CursorLocation = adUseClient
    addduzhersuser.Open "Select * from duzhe", addduzhecn, adOpenDynamic, adLockOptimistic

Combo1.AddItem "男", 0
Combo1.ListIndex = 0
Combo1.AddItem "女", 0
Combo1.ListIndex = 0
Set addduzhersuser1 = New Recordset
addduzhersuser1.CursorLocation = adUseClient
addduzhersuser1.Open "Select * from 读者类别", addduzhecn, adOpenDynamic, adLockOptimistic
    For i = 0 To addduzhersuser1.RecordCount
        Combo2.AddItem addduzhersuser1(0)
        addduzhersuser1.MoveNext
        If addduzhersuser1.EOF = True Then
             addduzhersuser1.MoveLast
             Combo2.ListIndex = 0
             Exit For
        End If
    Next i
End Sub

Private Sub Form_Unload(Cancel As Integer)
addduzhecn.Close
main.Show
main.Enabled = True
End Sub
Private Sub Text1_GotFocus()
Text1.BackColor = &HFFC0C0
End Sub

Private Sub Text1_LostFocus()
Text1.BackColor = &H80000014
End Sub

Private Sub Text2_GotFocus()
Text2.BackColor = &HFFC0C0
End Sub

Private Sub Text2_LostFocus()
Text2.BackColor = &H80000014
End Sub

Private Sub Text3_GotFocus()
Text3.BackColor = &HFFC0C0
End Sub

Private Sub Text3_LostFocus()
Text3.BackColor = &H80000014
End Sub


Private Sub Text4_GotFocus()
Text4.BackColor = &HFFC0C0
End Sub

Private Sub Text4_LostFocus()
Text4.BackColor = &H80000014
End Sub

Private Sub Text5_GotFocus()
Text5.BackColor = &HFFC0C0
End Sub

Private Sub Text5_LostFocus()
Text5.BackColor = &H80000014
End Sub
Private Sub Text6_GotFocus()
Text6.BackColor = &HFFC0C0
End Sub

Private Sub Text6_LostFocus()
Text6.BackColor = &H80000014
End Sub

Private Sub combo1_GotFocus()
Combo1.BackColor = &HFFC0C0
End Sub

Private Sub combo1_LostFocus()
Combo1.BackColor = &H80000014
End Sub
Private Sub combo2_GotFocus()
Combo2.BackColor = &HFFC0C0
End Sub

Private Sub combo2_LostFocus()
Combo2.BackColor = &H80000014
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -