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

📄 addinformation.frm

📁 希望给大家看看,能有点启发,是关于一个学生档案管理系统的文档.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form AddInformation 
   BackColor       =   &H8000000A&
   Caption         =   "添加学生信息"
   ClientHeight    =   3615
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3615
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "返回"
      Height          =   495
      Left            =   3360
      TabIndex        =   9
      Top             =   3000
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确认"
      Default         =   -1  'True
      Height          =   495
      Left            =   2160
      TabIndex        =   8
      Top             =   3000
      Width           =   855
   End
   Begin VB.Data Data1 
      Connect         =   "Access"
      DatabaseName    =   "studentInformation.mdb"
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   345
      Left            =   120
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   "学生信息"
      Top             =   2640
      Visible         =   0   'False
      Width           =   3975
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   600
      TabIndex        =   0
      Top             =   120
      Width           =   1335
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   2880
      TabIndex        =   1
      Top             =   120
      Width           =   1215
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   2880
      TabIndex        =   3
      Top             =   720
      Width           =   1215
   End
   Begin VB.TextBox Text4 
      Height          =   375
      Left            =   600
      TabIndex        =   4
      Top             =   1320
      Width           =   1335
   End
   Begin VB.TextBox Text5 
      Height          =   375
      Left            =   2880
      TabIndex        =   5
      Top             =   1320
      Width           =   1215
   End
   Begin VB.TextBox Text6 
      Height          =   375
      Left            =   600
      TabIndex        =   7
      Top             =   1920
      Width           =   2655
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      ItemData        =   "AddInformation.frx":0000
      Left            =   600
      List            =   "AddInformation.frx":000A
      TabIndex        =   2
      Top             =   840
      Width           =   1335
   End
   Begin VB.Label Label5 
      BackStyle       =   0  'Transparent
      Caption         =   "专业"
      Height          =   495
      Left            =   0
      TabIndex        =   15
      Top             =   1920
      Width           =   615
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "学号"
      Height          =   495
      Left            =   0
      TabIndex        =   14
      Top             =   240
      Width           =   735
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "姓名"
      Height          =   495
      Left            =   2160
      TabIndex        =   13
      Top             =   240
      Width           =   735
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "性别"
      Height          =   255
      Left            =   0
      TabIndex        =   12
      Top             =   840
      Width           =   495
   End
   Begin VB.Label Label4 
      BackStyle       =   0  'Transparent
      Caption         =   "出生年月"
      Height          =   375
      Left            =   2040
      TabIndex        =   11
      Top             =   840
      Width           =   735
   End
   Begin VB.Label Label6 
      BackStyle       =   0  'Transparent
      Caption         =   "寝室号"
      Height          =   495
      Left            =   0
      TabIndex        =   10
      Top             =   1320
      Width           =   735
   End
   Begin VB.Label Label7 
      BackStyle       =   0  'Transparent
      Caption         =   "寝室电话"
      Height          =   495
      Left            =   2040
      TabIndex        =   6
      Top             =   1320
      Width           =   735
   End
End
Attribute VB_Name = "AddInformation"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Text1.Text = "" Then
   Command1.Enabled = False
   Text1.SetFocus
Else
   Command1.Enabled = True
   Data1.Recordset.AddNew
   Data1.RecordSource = "学生信息"
   Data1.Recordset.Fields("学号") = Text1.Text
   Data1.Recordset.Fields("姓名") = Text2.Text
   Data1.Recordset.Fields("性别") = Combo1.Text
   Data1.Recordset.Fields("出生年月") = Text3.Text
   Data1.Recordset.Fields("寝室号") = Text4.Text
   Data1.Recordset.Fields("寝室电话") = Text5.Text
   Data1.Recordset.Fields("专业") = Text6.Text
   Data1.Recordset.Update
   Data1.Recordset.MoveLast
   Data1.Refresh
End If
 Text1.Text = "": Text2.Text = "": Text3.Text = "": Text4.Text = ""
 Text5.Text = "": Text6.Text = "": Combo1.Text = ""
End Sub

Private Sub Command2_Click()
  Me.Hide
  
End Sub
Private Sub Text1_LostFocus()
  Data1.RecordSource = "Select*From 学生信息 Where 学号 ='" & Text1.Text & "'"
  Data1.Refresh
  If Data1.Recordset.EOF Then
    Text2.SetFocus
  Else
    MsgBox "已存在此学生的信息!", vbOKOnly + vbExclamation, "提示"
    Data1.RecordSource = "学生信息"
    Data1.Refresh
  End If
End Sub

⌨️ 快捷键说明

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