www.pudn.com > chap07.rar > frmSystemParam.frm


VERSION 5.00 
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX" 
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TabCtl32.OCX" 
Begin VB.Form frmSystemParam  
   BorderStyle     =   3  'Fixed Dialog 
   Caption         =   "系统运行参数设置" 
   ClientHeight    =   4095 
   ClientLeft      =   2760 
   ClientTop       =   3750 
   ClientWidth     =   6015 
   Icon            =   "frmSystemParam.frx":0000 
   LinkTopic       =   "Form1" 
   LockControls    =   -1  'True 
   MaxButton       =   0   'False 
   MinButton       =   0   'False 
   ScaleHeight     =   4095 
   ScaleWidth      =   6015 
   ShowInTaskbar   =   0   'False 
   StartUpPosition =   1  '所有者中心 
   Begin MSAdodcLib.Adodc Adodc1  
      Height          =   330 
      Left            =   4725 
      Top             =   1710 
      Visible         =   0   'False 
      Width           =   1200 
      _ExtentX        =   2117 
      _ExtentY        =   582 
      ConnectMode     =   0 
      CursorLocation  =   3 
      IsolationLevel  =   -1 
      ConnectionTimeout=   15 
      CommandTimeout  =   30 
      CursorType      =   3 
      LockType        =   3 
      CommandType     =   8 
      CursorOptions   =   0 
      CacheSize       =   50 
      MaxRecords      =   0 
      BOFAction       =   0 
      EOFAction       =   0 
      ConnectStringType=   1 
      Appearance      =   1 
      BackColor       =   -2147483643 
      ForeColor       =   -2147483640 
      Orientation     =   0 
      Enabled         =   -1 
      Connect         =   "" 
      OLEDBString     =   "" 
      OLEDBFile       =   "" 
      DataSourceName  =   "" 
      OtherAttributes =   "" 
      UserName        =   "" 
      Password        =   "" 
      RecordSource    =   "" 
      Caption         =   "Adodc1" 
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}  
         Name            =   "宋体" 
         Size            =   9 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      _Version        =   393216 
   End 
   Begin VB.CommandButton cmdApply  
      Caption         =   "应用(&A)" 
      Enabled         =   0   'False 
      Height          =   375 
      Left            =   4680 
      TabIndex        =   3 
      Top             =   1050 
      Width           =   1215 
   End 
   Begin TabDlg.SSTab SSTab1  
      Height          =   3930 
      Left            =   75 
      TabIndex        =   2 
      Top             =   75 
      Width           =   4440 
      _ExtentX        =   7832 
      _ExtentY        =   6932 
      _Version        =   393216 
      Style           =   1 
      Tabs            =   1 
      TabHeight       =   520 
      TabCaption(0)   =   "参数设置" 
      TabPicture(0)   =   "frmSystemParam.frx":000C 
      Tab(0).ControlEnabled=   -1  'True 
      Tab(0).Control(0)=   "Label1" 
      Tab(0).Control(0).Enabled=   0   'False 
      Tab(0).Control(1)=   "Label2" 
      Tab(0).Control(1).Enabled=   0   'False 
      Tab(0).Control(2)=   "Label3" 
      Tab(0).Control(2).Enabled=   0   'False 
      Tab(0).Control(3)=   "Label4" 
      Tab(0).Control(3).Enabled=   0   'False 
      Tab(0).Control(4)=   "Label5" 
      Tab(0).Control(4).Enabled=   0   'False 
      Tab(0).Control(5)=   "Label6" 
      Tab(0).Control(5).Enabled=   0   'False 
      Tab(0).Control(6)=   "Text1(1)" 
      Tab(0).Control(6).Enabled=   0   'False 
      Tab(0).Control(7)=   "Text1(2)" 
      Tab(0).Control(7).Enabled=   0   'False 
      Tab(0).Control(8)=   "Text1(3)" 
      Tab(0).Control(8).Enabled=   0   'False 
      Tab(0).ControlCount=   9 
      Begin VB.TextBox Text1  
         Alignment       =   1  'Right Justify 
         DataField       =   "kssj" 
         DataSource      =   "Adodc1" 
         Height          =   300 
         Index           =   3 
         Left            =   1275 
         TabIndex        =   9 
         Top             =   1380 
         Width           =   2400 
      End 
      Begin VB.TextBox Text1  
         Alignment       =   1  'Right Justify 
         BackColor       =   &H80000014& 
         DataField       =   "pdt_bl" 
         DataSource      =   "Adodc1" 
         Height          =   300 
         Index           =   2 
         Left            =   1275 
         TabIndex        =   8 
         Top             =   975 
         Width           =   2400 
      End 
      Begin VB.TextBox Text1  
         Alignment       =   1  'Right Justify 
         DataField       =   "xzt_bl" 
         DataSource      =   "Adodc1" 
         Height          =   300 
         Index           =   1 
         Left            =   1275 
         TabIndex        =   7 
         Top             =   570 
         Width           =   2400 
      End 
      Begin VB.Label Label6  
         AutoSize        =   -1  'True 
         Caption         =   "分" 
         Height          =   180 
         Left            =   3705 
         TabIndex        =   12 
         Top             =   1440 
         Width           =   180 
      End 
      Begin VB.Label Label5  
         AutoSize        =   -1  'True 
         Caption         =   "%" 
         Height          =   180 
         Left            =   3705 
         TabIndex        =   11 
         Top             =   1035 
         Width           =   90 
      End 
      Begin VB.Label Label4  
         AutoSize        =   -1  'True 
         Caption         =   "%" 
         Height          =   180 
         Left            =   3705 
         TabIndex        =   10 
         Top             =   630 
         Width           =   90 
      End 
      Begin VB.Label Label3  
         AutoSize        =   -1  'True 
         Caption         =   "考试时间:" 
         Height          =   180 
         Left            =   405 
         TabIndex        =   6 
         Top             =   1440 
         Width           =   900 
      End 
      Begin VB.Label Label2  
         AutoSize        =   -1  'True 
         Caption         =   "判断题比例:" 
         Height          =   180 
         Left            =   225 
         TabIndex        =   5 
         Top             =   1035 
         Width           =   1080 
      End 
      Begin VB.Label Label1  
         AutoSize        =   -1  'True 
         Caption         =   "选择题比例:" 
         Height          =   180 
         Left            =   225 
         TabIndex        =   4 
         Top             =   630 
         Width           =   1080 
      End 
   End 
   Begin VB.CommandButton cmdCancel  
      Cancel          =   -1  'True 
      Caption         =   "取消(&C)" 
      Height          =   375 
      Left            =   4680 
      TabIndex        =   1 
      Top             =   585 
      Width           =   1215 
   End 
   Begin VB.CommandButton cmdOK  
      Caption         =   "确定(&O)" 
      Enabled         =   0   'False 
      Height          =   375 
      Left            =   4680 
      TabIndex        =   0 
      Top             =   120 
      Width           =   1215 
   End 
End 
Attribute VB_Name = "frmSystemParam" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Option Explicit 
Dim mParamRS As ADODB.Recordset 
Private Sub cmdApply_Click() 
    SetModified Not Save() 
End Sub 
 
Private Sub cmdCancel_Click() 
    Unload Me 
End Sub 
 
Private Sub cmdOK_Click() 
    On Error Resume Next 
     
    If cmdApply.Enabled = True Then 
        If Save() = True Then 
            Unload Me 
        End If 
    Else 
        Unload Me 
    End If 
End Sub 
 
Private Sub Form_Load() 
    On Error Resume Next 
     
    Set mParamRS = New ADODB.Recordset 
    mParamRS.Open "SELECT * FROM tbParam WHERE id=1", gadoCONN, adOpenKeyset, adLockPessimistic, adCmdText 
    Set Adodc1.Recordset = mParamRS 
     
    '--------------------------------------------- 
    cmdOK.Enabled = False 
    SetModified False 
End Sub 
 
Private Sub Form_Unload(Cancel As Integer) 
    On Error Resume Next 
     
    If Not mParamRS Is Nothing Then 
        If mParamRS.State = adStateOpen Then 
            mParamRS.Close 
        End If 
        Set mParamRS = Nothing 
    End If 
End Sub 
Private Sub SetModified(ByVal bModified As Boolean) 
    cmdApply.Enabled = bModified 
End Sub 
Private Sub Text1_Change(Index As Integer) 
    On Error Resume Next 
    If Text1(1).Text = "" Or Text1(2).Text = "" Or Text1(3).Text = "" Then 
        SetModified False 
        cmdOK.Enabled = False 
    Else 
        '---------------------------------------------------- 
        cmdOK.Enabled = True 
        SetModified True 
    End If 
End Sub 
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) 
    On Error Resume Next 
    If KeyCode = vbKeyReturn Then 
        SendKeys "{tab}" 
    End If 
End Sub 
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer) 
    On Error Resume Next 
     
    KeyAscii = AcceptNumber(KeyAscii) 
End Sub 
'保存记录 
Private Function Save() As Boolean 
    On Error Resume Next 
    '10:判断 
    If (CLng(Text1(1).Text) + CLng(Text1(2).Text)) <> 100 Then 
        MsgBox "选择题与判断题的比例和应该为100!", vbOKOnly + vbInformation, Me.Caption 
        Save = False 
        Exit Function 
    End If 
     
    '20: 
    Adodc1.Recordset.Move 0 
    Save = True 
End Function