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

📄 frmsubjectansweredit.frm

📁 本论文以“计算机考试系统”的开发为背景
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmSubjectAnswerEdit 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "备选答案编辑"
   ClientHeight    =   4875
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   7275
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   10.5
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4875
   ScaleWidth      =   7275
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command2 
      Caption         =   "返回(&R)"
      Height          =   435
      Left            =   5850
      TabIndex        =   7
      Top             =   4260
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "保存(&S)"
      Height          =   435
      Left            =   4230
      TabIndex        =   6
      Top             =   4260
      Width           =   1335
   End
   Begin VB.Frame Frame2 
      Caption         =   "备选答案"
      Height          =   2325
      Left            =   60
      TabIndex        =   5
      Top             =   1770
      Width           =   7125
      Begin VB.TextBox Text5 
         Height          =   375
         Left            =   1050
         TabIndex        =   14
         Top             =   1740
         Width           =   5955
      End
      Begin VB.TextBox Text4 
         Height          =   885
         Left            =   1050
         TabIndex        =   12
         Top             =   720
         Width           =   5955
      End
      Begin VB.TextBox Text3 
         Height          =   345
         Left            =   1050
         MaxLength       =   1
         TabIndex        =   9
         Top             =   240
         Width           =   2115
      End
      Begin VB.Label Label6 
         Caption         =   "备选备注:"
         Height          =   210
         Left            =   60
         TabIndex        =   13
         Top             =   1800
         Width           =   945
      End
      Begin VB.Label Label5 
         Caption         =   "备选答案:"
         Height          =   210
         Left            =   60
         TabIndex        =   11
         Top             =   720
         Width           =   945
      End
      Begin VB.Label Label4 
         Caption         =   "(请输入在显示在备选答案前的ABCD等等)"
         ForeColor       =   &H000000FF&
         Height          =   210
         Left            =   3210
         TabIndex        =   10
         Top             =   300
         Width           =   3780
      End
      Begin VB.Label Label3 
         Caption         =   "题目编码:"
         Height          =   210
         Left            =   90
         TabIndex        =   8
         Top             =   330
         Width           =   945
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "题目内容"
      Height          =   1635
      Left            =   60
      TabIndex        =   0
      Top             =   60
      Width           =   7125
      Begin VB.TextBox Text2 
         BackColor       =   &H80000018&
         Height          =   765
         Left            =   1050
         TabIndex        =   4
         Top             =   720
         Width           =   5955
      End
      Begin VB.TextBox Text1 
         BackColor       =   &H80000018&
         Height          =   375
         Left            =   1050
         Locked          =   -1  'True
         TabIndex        =   3
         Top             =   240
         Width           =   2085
      End
      Begin VB.Label Label2 
         Caption         =   "题目编号:"
         Height          =   210
         Left            =   90
         TabIndex        =   2
         Top             =   330
         Width           =   945
      End
      Begin VB.Label Label1 
         Caption         =   "题目内容:"
         Height          =   210
         Left            =   90
         TabIndex        =   1
         Top             =   720
         Width           =   945
      End
   End
End
Attribute VB_Name = "frmSubjectAnswerEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
''============================模块说明=================================
''名称:
''功能:
''作者:
''日期:
''备注:


''版本  修改日期                   修改人               原因


''====================================================================

Option Explicit
Private mblnEdit As Boolean
Private mlngID As Long

Public Sub EditSubjectAnswer(ByVal strSubjectID As String, ByVal strSubjectText As String, Optional ByVal lngID As Long = 0)
Dim rst As Recordset
    Text1 = strSubjectID
    Text2 = strSubjectText
    mlngID = lngID
    mblnEdit = (lngID <> 0)
    If mblnEdit Then
        Set rst = New Recordset
        rst.Open "select * from 题目明细 where ID=" & lngID, pCN, adOpenStatic, adLockBatchOptimistic
        Text3 = rst![题目编码]
        Text4 = rst![备选答案]
        Text5 = rst![题目备注] & ""
    End If
    Set rst = Nothing
    Me.Show 1
End Sub

Private Sub Command1_Click()
Dim rst As Recordset
On Error GoTo Proc_Exit
    If Len(Text3) = 0 Then
        MsgBox "题目编码不为空!", vbInformation
        GoTo Proc_Exit
    End If
    
    If Len(Text3) > 1 Then
        MsgBox "题目编码为一位的字母!", vbInformation
        GoTo Proc_Exit
    End If
    
    If Not (Asc(Text3) >= 65 And Asc(Text3) <= 90) And Not (Asc(Text3) >= 97 And Asc(Text3) <= 122) Then
        MsgBox "题目编码必须为字母!", vbInformation
        GoTo Proc_Exit
    End If
        
    If Len(Text4) = 0 Then
        MsgBox "备选答案不为空!", vbInformation
        GoTo Proc_Exit
    End If
    
    Set rst = New Recordset
    If mblnEdit Then
        rst.Open "select * from 题目明细 where ID=" & mlngID, pCN, adOpenStatic, adLockBatchOptimistic
    Else
        rst.Open "select * from 题目明细", pCN, adOpenStatic, adLockBatchOptimistic
        rst.AddNew
    End If
    
    rst![题目编号] = Text1
    rst![题目编码] = UCase(Text3)
    rst![备选答案] = Text4
    rst![题目备注] = Text5
    rst.UpdateBatch
    mblnEdit = False
    Text3 = ""
    Text4 = ""
    Text5 = ""
    Text3.SetFocus
Proc_Exit:
    If Err.Number <> 0 Then
        MsgBox "发生意外错误,错误号:" & Err.Number & " 错误描述:" & Err.Description
    End If
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub

⌨️ 快捷键说明

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