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

📄 frmaddclassinfo.frm

📁 VB类实现学生信息管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmAddclassinfo 
   Caption         =   "添加班级信息"
   ClientHeight    =   2610
   ClientLeft      =   45
   ClientTop       =   345
   ClientWidth     =   5805
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   2610
   ScaleWidth      =   5805
   Begin VB.ComboBox comboGrade 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   312
      Left            =   3720
      TabIndex        =   9
      Top             =   480
      Width           =   1692
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消添加"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   372
      Left            =   2760
      TabIndex        =   8
      Top             =   1920
      Width           =   1092
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确认添加"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   372
      Left            =   960
      TabIndex        =   7
      Top             =   1920
      Width           =   1092
   End
   Begin VB.TextBox txtClassroom 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   372
      Left            =   3720
      TabIndex        =   6
      Top             =   1200
      Width           =   1692
   End
   Begin VB.TextBox txtDirector 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   372
      Left            =   1200
      Locked          =   -1  'True
      TabIndex        =   0
      Top             =   1200
      Width           =   1332
   End
   Begin VB.TextBox txtClassno 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   372
      Left            =   1200
      MaxLength       =   6
      TabIndex        =   2
      Top             =   480
      Width           =   1332
   End
   Begin VB.Label Label4 
      Caption         =   "教室:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   2880
      TabIndex        =   5
      Top             =   1200
      Width           =   732
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      Caption         =   "班主任:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   120
      TabIndex        =   4
      Top             =   1200
      Width           =   972
   End
   Begin VB.Label Label2 
      Caption         =   "年级:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   2880
      TabIndex        =   3
      Top             =   480
      Width           =   732
   End
   Begin VB.Label Label1 
      Caption         =   "班号:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Left            =   240
      TabIndex        =   1
      Top             =   480
      Width           =   732
   End
End
Attribute VB_Name = "frmAddclassinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit



Private Sub Command1_Click()
    Dim tmp_class As Class
    Dim MsgText As String
    Dim txtSQL As String
    
    If Not Testtxt(txtClassno.Text) Then
        MsgBox "请输入班号!", vbOKOnly + vbExclamation, "警告"
        txtClassno.SetFocus
        Exit Sub
    End If
    
    If Not Testtxt(comboGrade.Text) Then
        MsgBox "请选择年级!", vbOKOnly + vbExclamation, "警告"
        comboGrade.SetFocus
        Exit Sub
    End If
    
    
    
    If Not Testtxt(txtClassroom.Text) Then
        MsgBox "请输入教室房间号!", vbOKOnly + vbExclamation, "警告"
        txtClassroom.SetFocus
        Exit Sub
    End If
    
    If Not IsNumeric(Trim(txtClassno.Text)) Then
        MsgBox "请输入数字!", vbOKOnly + vbExclamation, "警告"
        Exit Sub
        txtClassno.SetFocus
    End If
    
    Set tmp_class = New Class
    tmp_class.class_no = Trim(txtClassno.Text)
    tmp_class.query
    
    
    
    If tmp_class.State = 1 Then 'exist  duplicated class_no
        If (Trim(tmp_class.class_no) = Trim(txtClassno.Text)) Then
            MsgBox "班号已经存在,请重新输入班号!", vbOKOnly + vbExclamation, "警告"
            Exit Sub
            txtClassno.Text = ""
            txtClassno.SetFocus
        End If
    End If
    
    If tmp_class.State = 2 Then
         tmp_class.classroom = Trim(txtClassroom.Text)
         tmp_class.Grade = Trim(comboGrade.Text)
         tmp_class.insert
    End If
    
    If InStr(tmp_class.oper_flag, "insert_ok") > 0 Then
        MsgBox "添加班级信息成功!", vbOKOnly + vbExclamation, "添加班级信息"
        
    Else
        MsgBox "添加班级信息失败!", vbOKOnly + vbExclamation, "添加班级信息"
    End If
    
    txtClassno.Text = ""
    txtClassroom.Text = ""
    txtClassno.SetFocus
    
    Set tmp_class = Nothing
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub

Private Sub Form_Load()
Dim res As Long
    comboGrade.AddItem "小学一年级"
    comboGrade.AddItem "小学二年级"
    comboGrade.AddItem "小学三年级"
    comboGrade.AddItem "小学四年级"
    comboGrade.AddItem "小学五年级"
    comboGrade.AddItem "小学六年级"
    comboGrade.AddItem "初中一年级"
    comboGrade.AddItem "初中二年级"
    comboGrade.AddItem "初中三年级"
    comboGrade.AddItem "高中一年级"
    comboGrade.AddItem "高中二年级"
    comboGrade.AddItem "高中三年级"
    txtDirector.Locked = False
    txtDirector.Text = login_user.user_Id
    txtDirector.Locked = True
    
End Sub

⌨️ 快捷键说明

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