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

📄 frmeditcomputer.frm

📁 本论文以西电基础教学实验中心学生上机管理系统为背景
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmEditComputer 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "修改计算机信息"
   ClientHeight    =   4455
   ClientLeft      =   6345
   ClientTop       =   2730
   ClientWidth     =   3750
   Icon            =   "frmEditComputer.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4455
   ScaleWidth      =   3750
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton cmdExit 
      Caption         =   "退 出"
      Height          =   375
      Left            =   2520
      TabIndex        =   9
      Top             =   3840
      Width           =   855
   End
   Begin VB.CommandButton cmdSave 
      Caption         =   "保 存"
      Enabled         =   0   'False
      Height          =   375
      Left            =   1440
      TabIndex        =   4
      Top             =   3840
      Width           =   855
   End
   Begin VB.Frame FraComputer 
      Caption         =   "计算机信息"
      Height          =   3255
      Left            =   360
      TabIndex        =   0
      Top             =   360
      Width           =   3015
      Begin VB.TextBox txtTier 
         Height          =   270
         Left            =   1200
         MaxLength       =   2
         TabIndex        =   2
         Top             =   1440
         Width           =   1455
      End
      Begin VB.TextBox txtCPT_Memo 
         Height          =   855
         Left            =   240
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   3
         Top             =   2160
         Width           =   2415
      End
      Begin VB.TextBox txtRow 
         Height          =   270
         Left            =   1200
         MaxLength       =   2
         TabIndex        =   1
         Top             =   960
         Width           =   1455
      End
      Begin VB.Label lblCPT_IDList 
         AutoSize        =   -1  'True
         Height          =   180
         Left            =   1200
         TabIndex        =   10
         Top             =   480
         Width           =   90
      End
      Begin VB.Label lblCPT_Memo 
         AutoSize        =   -1  'True
         Caption         =   "计算机描述:"
         Height          =   180
         Left            =   240
         TabIndex        =   8
         Top             =   1920
         Width           =   1080
      End
      Begin VB.Label lblTier 
         AutoSize        =   -1  'True
         Caption         =   "列号:"
         Height          =   180
         Left            =   240
         TabIndex        =   7
         Top             =   1440
         Width           =   540
      End
      Begin VB.Label lblRow 
         AutoSize        =   -1  'True
         Caption         =   "行号:"
         Height          =   180
         Left            =   240
         TabIndex        =   6
         Top             =   960
         Width           =   540
      End
      Begin VB.Label lblCPT_ID 
         AutoSize        =   -1  'True
         Caption         =   "计算机ID:"
         Height          =   180
         Left            =   240
         TabIndex        =   5
         Top             =   480
         Width           =   900
      End
   End
End
Attribute VB_Name = "frmEditComputer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''                                                                ''
''Filename       frmEditComputer.frm                              ''
''                                                                ''
''Created On     2004.2.22                                        ''
''                                                                ''
''Description    修改计算机信息窗体                               ''
''                                                                ''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim rsOperateLog As Recordset
Dim rsLog As Recordset
Dim RsComputerEdit As Recordset
Dim row As Integer, tier As Integer
Dim rsCPTrow  As Recordset

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''显示须修改的计算机的详细信息,并设置保存按钮为禁用              ''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub Form_Load()
Set RsComputerEdit = New Recordset
RsComputerEdit.Open "select * from TbComputer where CPT_ID='" & frmComputer.StrItem & "'", Modmain.conn, 3, 2

With RsComputerEdit
    lblCPT_IDList.Caption = .Fields!CPT_ID
    txtRow.Text = .Fields!row
    txtTier.Text = .Fields!tier
    If .Fields!CPT_Memo <> "" Then
        txtCPT_Memo.Text = .Fields!CPT_Memo
    Else
        txtCPT_Memo.Text = ""
    End If
End With
cmdSave.Enabled = False
End Sub

Private Sub cmdExit_Click()
Unload Me
End Sub

Private Sub txtRow_Change()
cmdSave.Enabled = True
End Sub

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

Private Sub txtRow_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 txtTier_Change()
cmdSave.Enabled = True
End Sub

Private Sub txtTier_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 cmdSave_Click()
If Judge = True Then
    row = CInt(txtRow.Text)
    tier = CInt(txtTier.Text)
    Set rsCPTrow = New Recordset
    rsCPTrow.Open "select * from tbComputer where Row=" & row & " and Tier=" & tier & "", Modmain.conn, 3, 2
    If rsCPTrow.RecordCount <> 0 Then
        MsgBox "该位置的计算机已经存在,请重新编写!", vbOKOnly + vbCritical, "机房管理"
        txtRow.Text = ""
        txtTier.Text = ""
        txtRow.SetFocus
    ElseIf MsgBox("确实要保存修改吗?", vbYesNo + vbQuestion, "机房管理") = vbYes Then
        SaveInfo
        Unload Me
   End If
End If
End Sub
Private Sub SaveInfo()
    RsComputerEdit.Fields("ROW") = txtRow.Text
    RsComputerEdit.Fields("Tier") = txtTier.Text
    If Trim(txtCPT_Memo.Text) <> "" Then
        RsComputerEdit.Fields("CPT_Memo") = Trim(txtCPT_Memo.Text)
    Else
        RsComputerEdit.Fields("CPT_Memo") = ""
    End If
    RsComputerEdit.Update
    AddLog
    MsgBox "保存成功", vbOKOnly + vbInformation, "机房管理"    '保存完毕并提醒
End Sub

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''判断行号、列号是否为空,若为空则将焦点置到填写处,提醒用户填写  ''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function Judge() As Boolean
    If Trim(txtRow) = "" Then
        MsgBox "行号不能为空", vbOKOnly + vbExclamation, "机房管理"
        txtRow.SetFocus
        ElseIf Trim(txtTier) = "" Then
            MsgBox "列号不能为空", vbOKOnly + vbExclamation, "机房管理"
            txtTier.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='L10'", 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 & lblCPT_IDList.Caption & strTemp
rsOperateLog.Update
End Sub

⌨️ 快捷键说明

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