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

📄 frmaddspeciality.frm

📁 本论文以西电基础教学实验中心学生上机管理系统为背景
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmAddSpeciality 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "添加专业信息"
   ClientHeight    =   4380
   ClientLeft      =   5550
   ClientTop       =   2640
   ClientWidth     =   3690
   Icon            =   "frmAddSpeciality.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4380
   ScaleWidth      =   3690
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton cmdSave 
      Caption         =   "保 存"
      Height          =   375
      Left            =   1320
      TabIndex        =   4
      Top             =   3720
      Width           =   855
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "退 出"
      Height          =   375
      Left            =   2520
      TabIndex        =   5
      Top             =   3720
      Width           =   855
   End
   Begin VB.Frame FraInstitute 
      Caption         =   "专业信息"
      Height          =   3135
      Left            =   360
      TabIndex        =   0
      Top             =   360
      Width           =   3015
      Begin VB.TextBox txtS_ID 
         Height          =   270
         Left            =   1200
         MaxLength       =   1
         TabIndex        =   1
         Top             =   480
         Width           =   1455
      End
      Begin VB.TextBox txtS_Name 
         Height          =   270
         Left            =   1200
         MaxLength       =   10
         TabIndex        =   2
         Top             =   960
         Width           =   1455
      End
      Begin VB.TextBox txtS_Memo 
         Height          =   1215
         Left            =   360
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   3
         Top             =   1680
         Width           =   2295
      End
      Begin VB.Label lblS_ID 
         AutoSize        =   -1  'True
         Caption         =   "专业ID:"
         Height          =   180
         Left            =   360
         TabIndex        =   8
         Top             =   480
         Width           =   720
      End
      Begin VB.Label lblS_Name 
         AutoSize        =   -1  'True
         Caption         =   "专业名:"
         Height          =   180
         Left            =   360
         TabIndex        =   7
         Top             =   960
         Width           =   720
      End
      Begin VB.Label lblS_Memo 
         AutoSize        =   -1  'True
         Caption         =   "专业描述:"
         Height          =   180
         Left            =   360
         TabIndex        =   6
         Top             =   1440
         Width           =   900
      End
   End
End
Attribute VB_Name = "frmAddSpeciality"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''                                                                ''
''Filename       frmAddSpeciality.frm                             ''
''                                                                ''
''Created On     2004.2.10                                        ''
''                                                                ''
''Description    添加专业信息窗体                                 ''
''                                                                ''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Dim rsSpeciality As Recordset
Dim rsInstitute As Recordset
Dim rsOperateLog As Recordset
Dim rsLog As Recordset
Dim rsS_ID As Recordset
Dim RsS_Name As Recordset
Dim str As String
Public StrS_Name As String
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdSave_Click()
If Judge = True Then
    If MsgBox("确实要保存吗?", vbYesNo + vbQuestion, "机房管理") = vbYes Then
        SaveInfo
        txtS_ID.Text = ""
        txtS_Name.Text = ""
        txtS_Memo.Text = ""
        txtS_ID.SetFocus
    End If
End If
End Sub

Private Sub Form_Load()
If frmInstitute.AddType = "II" Then
    Set rsSpeciality = New Recordset
    rsSpeciality.Open "select * from TbSpeciality", Modmain.conn, 3, 2

    Set rsInstitute = New Recordset
    rsInstitute.Open "select * from TbInstitute where I_Name ='" & frmInstitute.NodeText & "' ", Modmain.conn, 3, 2
Else
    Set rsSpeciality = New Recordset
    rsSpeciality.Open "select * from TbSpeciality where S_Name ='" & frmInstitute.NodeText & "' ", Modmain.conn, 3, 2
    str = rsSpeciality.Fields("I_ID")
End If
End Sub

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''只能输入数字                                                    ''
''按回车键时,跳到下一格                                          ''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Private Sub txtS_ID_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    SendKeys "{tab}"
End If
Dim L As Boolean
    L = Chr(KeyAscii) Like "[0-9]" Or KeyAscii = 8
    If L = False Then
        KeyAscii = 0
    End If
End Sub

Private Sub txtS_Name_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    SendKeys "{tab}"
End If
End Sub

Private Sub SaveInfo()
    rsSpeciality.AddNew
    StrS_Name = txtS_Name.Text
    If frmInstitute.AddType = "II" Then
        rsSpeciality.Fields("I_ID") = rsInstitute.Fields!I_ID
    Else
        rsSpeciality.Fields("I_ID") = str
    End If
    rsSpeciality.Fields("S_ID") = txtS_ID.Text
    rsSpeciality.Fields("S_Name") = Trim(CStr(txtS_Name.Text))
    If Trim(txtS_Memo.Text) <> "" Then
        rsSpeciality.Fields("S_Memo") = Trim(txtS_Memo.Text)
    Else
        rsSpeciality.Fields("S_Memo") = ""
    End If
    AddLog
    rsSpeciality.Update
    MsgBox "保存成功", vbOKOnly + vbInformation, "机房管理"    '保存完毕并提醒
    frmInstitute.AddSpecialityNodes
    
    'rsSpeciality.Close
    'Set rsSpeciality = Nothing

End Sub

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''验证输入的专业ID是否已经存在,若存在则清空重新编写              ''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub txtS_ID_LostFocus()
Set rsS_ID = New Recordset
Dim strS_ID As String
If frmInstitute.AddType = "II" Then
    strS_ID = "select * from TbSpeciality where S_ID='" & txtS_ID.Text & "' and I_ID='" & rsInstitute.Fields!I_ID & "'"
Else
    strS_ID = "select * from TbSpeciality where S_ID='" & txtS_ID.Text & "' and I_ID='" & str & "'"
End If
rsS_ID.Open strS_ID, Modmain.conn, 3, 2
If rsS_ID.RecordCount <> 0 Then
    MsgBox "专业ID已存在,请重新编写!", vbOKOnly + vbCritical, "机房管理"
    txtS_ID.Text = ""
    txtS_ID.SetFocus
End If
rsS_ID.Close
Set rsS_ID = Nothing
End Sub
Private Sub txtI_Name_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    SendKeys "{tab}"
End If
End Sub

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''验证输入的专业名是否已经存在,若存在则清空重新编写              ''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub txtS_Name_LostFocus()
Set RsS_Name = New Recordset
Dim StrS_Name  As String
StrS_Name = "select * from TbSpeciality where S_Name ='" & Trim(CStr(txtS_Name.Text)) & "'"
RsS_Name.Open StrS_Name, Modmain.conn, 3, 2
If RsS_Name.RecordCount <> 0 Then
    MsgBox "该专业名已存在,请重新编写!", vbOKOnly + vbCritical, "机房管理"
    txtS_Name.Text = ""
    txtS_Name.SetFocus
End If
RsS_Name.Close
Set RsS_Name = Nothing
End Sub

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''验证输入的院系ID、院系名是否为空,若为空则重新添加              ''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function Judge() As Boolean
If Trim(txtS_ID) = "" Then
    MsgBox "专业ID不能为空", vbOKOnly + vbExclamation, "机房管理"
    txtS_ID.SetFocus
    ElseIf Trim(txtS_Name) = "" Then
        MsgBox "专业名称不能为空", vbOKOnly + vbExclamation, "机房管理"
        txtS_Name.SetFocus
        Else
            Judge = True
End If
End Function



''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''将用户添加班级的信息记入操作日志                                ''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub AddLog()
Dim strEvents As String
Dim strTemp As String
strTemp = "'"
Set rsOperateLog = New Recordset
rsOperateLog.Open "select * from tbOperateLog", Modmain.conn, 3, 2
Set rsLog = New Recordset
rsLog.Open "select * from tblog where L_ID='L07'", Modmain.conn, 3, 2
strEvents = rsLog.Fields!Events

rsOperateLog.AddNew
    rsOperateLog.Fields!U_ID = frmLoad.StrU_ID
    rsOperateLog.Fields!Time = Time
    rsOperateLog.Fields!Date = Date
    rsOperateLog.Fields!Events = strEvents
    rsOperateLog.Fields!Description = strEvents & strTemp & txtS_Name.Text & strTemp
rsOperateLog.Update
End Sub


⌨️ 快捷键说明

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