frmcj2.frm
上传用户:bubble
上传日期:2007-03-02
资源大小:403k
文件大小:23k
源码类别:

教育系统应用

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Begin VB.Form frmcj2 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "成绩添加"
  5.    ClientHeight    =   6120
  6.    ClientLeft      =   2640
  7.    ClientTop       =   1485
  8.    ClientWidth     =   7080
  9.    LinkTopic       =   "Form2"
  10.    MaxButton       =   0   'False
  11.    MDIChild        =   -1  'True
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   6120
  14.    ScaleWidth      =   7080
  15.    Begin VB.CommandButton Command1 
  16.       Caption         =   "确定"
  17.       Height          =   270
  18.       Left            =   1800
  19.       TabIndex        =   30
  20.       Top             =   5805
  21.       Width           =   1095
  22.    End
  23.    Begin VB.CommandButton Command2 
  24.       Caption         =   "取消"
  25.       Height          =   270
  26.       Left            =   4320
  27.       TabIndex        =   31
  28.       Top             =   5805
  29.       Width           =   1095
  30.    End
  31.    Begin VB.Frame Frame1 
  32.       Height          =   5055
  33.       Left            =   120
  34.       TabIndex        =   0
  35.       Top             =   720
  36.       Width           =   6735
  37.       Begin VB.ListBox List1 
  38.          Appearance      =   0  'Flat
  39.          Height          =   930
  40.          Left            =   1440
  41.          TabIndex        =   43
  42.          Top             =   1480
  43.          Visible         =   0   'False
  44.          Width           =   1335
  45.       End
  46.       Begin VB.ComboBox Combo2 
  47.          BackColor       =   &H80000018&
  48.          Height          =   300
  49.          Left            =   1440
  50.          TabIndex        =   39
  51.          Top             =   840
  52.          Width           =   1335
  53.       End
  54.       Begin VB.ComboBox Combo3 
  55.          BackColor       =   &H80000018&
  56.          Height          =   300
  57.          Left            =   4800
  58.          TabIndex        =   38
  59.          Top             =   840
  60.          Width           =   1335
  61.       End
  62.       Begin VB.ComboBox Combo4 
  63.          BackColor       =   &H80000018&
  64.          Height          =   300
  65.          Left            =   1440
  66.          TabIndex        =   37
  67.          Top             =   1200
  68.          Width           =   1335
  69.       End
  70.       Begin VB.ComboBox Combo1 
  71.          BackColor       =   &H80000018&
  72.          Height          =   300
  73.          Left            =   1440
  74.          TabIndex        =   36
  75.          Top             =   480
  76.          Width           =   2655
  77.       End
  78.       Begin VB.TextBox Text2 
  79.          BackColor       =   &H80000018&
  80.          Height          =   270
  81.          Left            =   4800
  82.          TabIndex        =   35
  83.          Top             =   1200
  84.          Width           =   1335
  85.       End
  86.       Begin VB.Frame Frame3 
  87.          Caption         =   "请输入各科成绩"
  88.          Height          =   3015
  89.          Left            =   120
  90.          TabIndex        =   1
  91.          Top             =   1920
  92.          Width           =   6495
  93.          Begin VB.TextBox Text1 
  94.             Appearance      =   0  'Flat
  95.             BackColor       =   &H80000018&
  96.             ForeColor       =   &H000000FF&
  97.             Height          =   270
  98.             Index           =   13
  99.             Left            =   5040
  100.             TabIndex        =   15
  101.             Text            =   "Text1"
  102.             Top             =   2520
  103.             Visible         =   0   'False
  104.             Width           =   1215
  105.          End
  106.          Begin VB.TextBox Text1 
  107.             Appearance      =   0  'Flat
  108.             BackColor       =   &H80000018&
  109.             ForeColor       =   &H000000FF&
  110.             Height          =   270
  111.             Index           =   12
  112.             Left            =   1680
  113.             TabIndex        =   14
  114.             Text            =   "Text1"
  115.             Top             =   2520
  116.             Visible         =   0   'False
  117.             Width           =   1215
  118.          End
  119.          Begin VB.TextBox Text1 
  120.             Appearance      =   0  'Flat
  121.             BackColor       =   &H80000018&
  122.             ForeColor       =   &H000000FF&
  123.             Height          =   270
  124.             Index           =   11
  125.             Left            =   5040
  126.             TabIndex        =   13
  127.             Text            =   "Text1"
  128.             Top             =   2160
  129.             Visible         =   0   'False
  130.             Width           =   1215
  131.          End
  132.          Begin VB.TextBox Text1 
  133.             Appearance      =   0  'Flat
  134.             BackColor       =   &H80000018&
  135.             ForeColor       =   &H000000FF&
  136.             Height          =   270
  137.             Index           =   10
  138.             Left            =   1680
  139.             TabIndex        =   12
  140.             Text            =   "Text1"
  141.             Top             =   2160
  142.             Visible         =   0   'False
  143.             Width           =   1215
  144.          End
  145.          Begin VB.TextBox Text1 
  146.             Appearance      =   0  'Flat
  147.             BackColor       =   &H80000018&
  148.             ForeColor       =   &H000000FF&
  149.             Height          =   270
  150.             Index           =   9
  151.             Left            =   5040
  152.             TabIndex        =   11
  153.             Text            =   "Text1"
  154.             Top             =   1800
  155.             Visible         =   0   'False
  156.             Width           =   1215
  157.          End
  158.          Begin VB.TextBox Text1 
  159.             Appearance      =   0  'Flat
  160.             BackColor       =   &H80000018&
  161.             ForeColor       =   &H000000FF&
  162.             Height          =   270
  163.             Index           =   8
  164.             Left            =   1680
  165.             TabIndex        =   10
  166.             Text            =   "Text1"
  167.             Top             =   1800
  168.             Visible         =   0   'False
  169.             Width           =   1215
  170.          End
  171.          Begin VB.TextBox Text1 
  172.             Appearance      =   0  'Flat
  173.             BackColor       =   &H80000018&
  174.             ForeColor       =   &H000000FF&
  175.             Height          =   270
  176.             Index           =   7
  177.             Left            =   5040
  178.             TabIndex        =   9
  179.             Text            =   "Text1"
  180.             Top             =   1440
  181.             Visible         =   0   'False
  182.             Width           =   1215
  183.          End
  184.          Begin VB.TextBox Text1 
  185.             Appearance      =   0  'Flat
  186.             BackColor       =   &H80000018&
  187.             ForeColor       =   &H000000FF&
  188.             Height          =   270
  189.             Index           =   6
  190.             Left            =   1680
  191.             TabIndex        =   8
  192.             Text            =   "Text1"
  193.             Top             =   1440
  194.             Visible         =   0   'False
  195.             Width           =   1215
  196.          End
  197.          Begin VB.TextBox Text1 
  198.             Appearance      =   0  'Flat
  199.             BackColor       =   &H80000018&
  200.             ForeColor       =   &H000000FF&
  201.             Height          =   270
  202.             Index           =   5
  203.             Left            =   5040
  204.             TabIndex        =   7
  205.             Text            =   "Text1"
  206.             Top             =   1080
  207.             Visible         =   0   'False
  208.             Width           =   1215
  209.          End
  210.          Begin VB.TextBox Text1 
  211.             Appearance      =   0  'Flat
  212.             BackColor       =   &H80000018&
  213.             ForeColor       =   &H000000FF&
  214.             Height          =   270
  215.             Index           =   4
  216.             Left            =   1680
  217.             TabIndex        =   6
  218.             Text            =   "Text1"
  219.             Top             =   1080
  220.             Visible         =   0   'False
  221.             Width           =   1215
  222.          End
  223.          Begin VB.TextBox Text1 
  224.             Appearance      =   0  'Flat
  225.             BackColor       =   &H80000018&
  226.             ForeColor       =   &H000000FF&
  227.             Height          =   270
  228.             Index           =   3
  229.             Left            =   5040
  230.             TabIndex        =   5
  231.             Text            =   "Text1"
  232.             Top             =   720
  233.             Visible         =   0   'False
  234.             Width           =   1215
  235.          End
  236.          Begin VB.TextBox Text1 
  237.             Appearance      =   0  'Flat
  238.             BackColor       =   &H80000018&
  239.             ForeColor       =   &H000000FF&
  240.             Height          =   270
  241.             Index           =   2
  242.             Left            =   1680
  243.             TabIndex        =   4
  244.             Text            =   "Text1"
  245.             Top             =   720
  246.             Visible         =   0   'False
  247.             Width           =   1215
  248.          End
  249.          Begin VB.TextBox Text1 
  250.             Appearance      =   0  'Flat
  251.             BackColor       =   &H80000018&
  252.             ForeColor       =   &H000000FF&
  253.             Height          =   270
  254.             Index           =   1
  255.             Left            =   5040
  256.             TabIndex        =   3
  257.             Text            =   "Text1"
  258.             Top             =   360
  259.             Visible         =   0   'False
  260.             Width           =   1215
  261.          End
  262.          Begin VB.TextBox Text1 
  263.             Appearance      =   0  'Flat
  264.             BackColor       =   &H80000018&
  265.             ForeColor       =   &H000000FF&
  266.             Height          =   270
  267.             Index           =   0
  268.             Left            =   1680
  269.             TabIndex        =   2
  270.             Text            =   "Text1"
  271.             Top             =   360
  272.             Visible         =   0   'False
  273.             Width           =   1215
  274.          End
  275.          Begin VB.Line Line1 
  276.             BorderColor     =   &H80000018&
  277.             X1              =   3120
  278.             X2              =   3120
  279.             Y1              =   120
  280.             Y2              =   3000
  281.          End
  282.          Begin VB.Label Label1 
  283.             Caption         =   "语文:"
  284.             Height          =   255
  285.             Index           =   0
  286.             Left            =   240
  287.             TabIndex        =   32
  288.             Top             =   360
  289.             Visible         =   0   'False
  290.             Width           =   735
  291.          End
  292.          Begin VB.Label Label1 
  293.             Caption         =   "语文:"
  294.             Height          =   375
  295.             Index           =   13
  296.             Left            =   3480
  297.             TabIndex        =   28
  298.             Top             =   2520
  299.             Visible         =   0   'False
  300.             Width           =   735
  301.          End
  302.          Begin VB.Label Label1 
  303.             Caption         =   "语文:"
  304.             Height          =   375
  305.             Index           =   12
  306.             Left            =   240
  307.             TabIndex        =   27
  308.             Top             =   2520
  309.             Visible         =   0   'False
  310.             Width           =   735
  311.          End
  312.          Begin VB.Label Label1 
  313.             Caption         =   "语文:"
  314.             Height          =   255
  315.             Index           =   11
  316.             Left            =   3480
  317.             TabIndex        =   26
  318.             Top             =   2160
  319.             Visible         =   0   'False
  320.             Width           =   735
  321.          End
  322.          Begin VB.Label Label1 
  323.             Caption         =   "语文:"
  324.             Height          =   255
  325.             Index           =   10
  326.             Left            =   240
  327.             TabIndex        =   25
  328.             Top             =   2160
  329.             Visible         =   0   'False
  330.             Width           =   735
  331.          End
  332.          Begin VB.Label Label1 
  333.             Caption         =   "语文:"
  334.             Height          =   255
  335.             Index           =   9
  336.             Left            =   3480
  337.             TabIndex        =   24
  338.             Top             =   1800
  339.             Visible         =   0   'False
  340.             Width           =   735
  341.          End
  342.          Begin VB.Label Label1 
  343.             Caption         =   "语文:"
  344.             Height          =   255
  345.             Index           =   8
  346.             Left            =   240
  347.             TabIndex        =   23
  348.             Top             =   1800
  349.             Visible         =   0   'False
  350.             Width           =   735
  351.          End
  352.          Begin VB.Label Label1 
  353.             Caption         =   "语文:"
  354.             Height          =   255
  355.             Index           =   7
  356.             Left            =   3480
  357.             TabIndex        =   22
  358.             Top             =   1440
  359.             Visible         =   0   'False
  360.             Width           =   735
  361.          End
  362.          Begin VB.Label Label1 
  363.             Caption         =   "语文:"
  364.             Height          =   255
  365.             Index           =   6
  366.             Left            =   240
  367.             TabIndex        =   21
  368.             Top             =   1440
  369.             Visible         =   0   'False
  370.             Width           =   735
  371.          End
  372.          Begin VB.Label Label1 
  373.             Caption         =   "语文:"
  374.             Height          =   255
  375.             Index           =   5
  376.             Left            =   3480
  377.             TabIndex        =   20
  378.             Top             =   1080
  379.             Visible         =   0   'False
  380.             Width           =   735
  381.          End
  382.          Begin VB.Label Label1 
  383.             Caption         =   "语文:"
  384.             Height          =   255
  385.             Index           =   4
  386.             Left            =   240
  387.             TabIndex        =   19
  388.             Top             =   1080
  389.             Visible         =   0   'False
  390.             Width           =   735
  391.          End
  392.          Begin VB.Label Label1 
  393.             Caption         =   "语文:"
  394.             Height          =   255
  395.             Index           =   3
  396.             Left            =   3480
  397.             TabIndex        =   18
  398.             Top             =   720
  399.             Visible         =   0   'False
  400.             Width           =   735
  401.          End
  402.          Begin VB.Label Label1 
  403.             Caption         =   "语文:"
  404.             Height          =   255
  405.             Index           =   2
  406.             Left            =   240
  407.             TabIndex        =   17
  408.             Top             =   720
  409.             Visible         =   0   'False
  410.             Width           =   735
  411.          End
  412.          Begin VB.Label Label1 
  413.             Caption         =   "语文:"
  414.             Height          =   255
  415.             Index           =   1
  416.             Left            =   3480
  417.             TabIndex        =   16
  418.             Top             =   360
  419.             Visible         =   0   'False
  420.             Width           =   735
  421.          End
  422.       End
  423.       Begin VB.Label Label4 
  424.          Caption         =   "学期:"
  425.          Height          =   255
  426.          Left            =   840
  427.          TabIndex        =   42
  428.          Top             =   525
  429.          Width           =   615
  430.       End
  431.       Begin VB.Label Label3 
  432.          Caption         =   "班级:"
  433.          Height          =   255
  434.          Left            =   840
  435.          TabIndex        =   41
  436.          Top             =   885
  437.          Width           =   615
  438.       End
  439.       Begin VB.Label Label2 
  440.          Caption         =   "学号:"
  441.          Height          =   255
  442.          Left            =   840
  443.          TabIndex        =   40
  444.          Top             =   1230
  445.          Width           =   615
  446.       End
  447.       Begin VB.Label Label5 
  448.          Caption         =   "类型:"
  449.          Height          =   255
  450.          Left            =   3960
  451.          TabIndex        =   34
  452.          Top             =   885
  453.          Width           =   615
  454.       End
  455.       Begin VB.Label Label7 
  456.          Caption         =   "姓名:"
  457.          Height          =   255
  458.          Left            =   3960
  459.          TabIndex        =   33
  460.          Top             =   1245
  461.          Width           =   615
  462.       End
  463.    End
  464.    Begin VB.Label Label6 
  465.       Caption         =   "成绩添加"
  466.       BeginProperty Font 
  467.          Name            =   "楷体_GB2312"
  468.          Size            =   21.75
  469.          Charset         =   134
  470.          Weight          =   400
  471.          Underline       =   0   'False
  472.          Italic          =   0   'False
  473.          Strikethrough   =   0   'False
  474.       EndProperty
  475.       ForeColor       =   &H00C00000&
  476.       Height          =   495
  477.       Left            =   2400
  478.       TabIndex        =   29
  479.       Top             =   120
  480.       Width           =   2055
  481.    End
  482. End
  483. Attribute VB_Name = "frmcj2"
  484. Attribute VB_GlobalNameSpace = False
  485. Attribute VB_Creatable = False
  486. Attribute VB_PredeclaredId = True
  487. Attribute VB_Exposed = False
  488. Dim gg As Integer
  489. Dim kechengcount As Integer
  490. Public aaa As Boolean
  491. Private Sub Combo1_Click()
  492. If Combo2.Text = "" Or Combo1.Text = "" Then
  493. Exit Sub
  494. End If
  495. fillkencheng
  496. End Sub
  497. Private Sub Combo2_Click()
  498. Dim mrc As ADODB.Recordset
  499. txtsql = "select  DISTINCT 学号  from xj where 班级='" & Trim(Combo2.Text) & "' order by 学号"
  500. Set mrc = ExecuteSQL(txtsql)
  501. If mrc.EOF = True Then
  502. Combo4.Clear
  503. Text2.Text = ""
  504. Else
  505. mrc.MoveFirst
  506. Combo4.Clear
  507. Do While Not mrc.EOF
  508.   Combo4.AddItem mrc.Fields(0)
  509.  
  510.  mrc.MoveNext
  511.  Loop
  512.  Combo4.ListIndex = 0
  513. Set mrc = Nothing
  514. End If
  515. If Combo2.Text = "" Or Combo1.Text = "" Then
  516. Exit Sub
  517. End If
  518. fillkencheng
  519. End Sub
  520. Private Sub Combo4_Change()
  521. If Trim(Combo4.Text) = "" Then
  522.  List1.Clear
  523.  List1.Visible = False
  524.  Exit Sub
  525. End If
  526. If aaa = True Then
  527. List1.Clear
  528.  List1.Visible = False
  529.      Dim mrc As ADODB.Recordset
  530. txtsql = "select   DISTINCT 姓名 from xj where 学号 ='" & Trim(Combo4.Text) & "'"
  531. Set mrc = ExecuteSQL(txtsql)
  532.  If mrc.EOF = True Then
  533.   sss = MsgBox("没有此学号!", vbExclamation + vbOKOnly, "警告")
  534.   Text2.Text = ""
  535.   Exit Sub
  536. End If
  537. Text2.Text = mrc.Fields(0)
  538.  Set mrc = Nothing
  539.  Exit Sub
  540. End If
  541.  Dim rst As ADODB.Recordset
  542.   Dim str As String
  543.   str = "select 学号 from xj where 学号 like'" & Trim(Combo4.Text) & "%' and 班级='" & Trim(Combo2.Text) & "' order by 学号"
  544.  Set rst = ExecuteSQL(str)
  545.   If rst.EOF = True Then
  546.    List1.Clear
  547.    List1.Visible = False
  548.    Set rst = Nothing
  549.    Exit Sub
  550.   End If
  551.   List1.Clear
  552.   Do Until rst.EOF
  553.    List1.AddItem rst.Fields(0)
  554.    rst.MoveNext
  555.   Loop
  556.    Set rst = Nothing
  557.   List1.Visible = True
  558. End Sub
  559. Private Sub Combo4_Click()
  560. Dim mrc As ADODB.Recordset
  561. txtsql = "select   DISTINCT 姓名 from xj where 学号 ='" & Trim(Combo4.Text) & "'"
  562. Set mrc = ExecuteSQL(txtsql)
  563. Text2.Text = mrc.Fields(0)
  564.  Set mrc = Nothing
  565. End Sub
  566. Private Sub Combo4_KeyPress(KeyAscii As Integer)
  567. If KeyAscii = 13 Then
  568. Dim mrc As ADODB.Recordset
  569. txtsql = "select   DISTINCT 姓名 from xj where 学号 ='" & Trim(Combo4.Text) & "'"
  570. Set mrc = ExecuteSQL(txtsql)
  571.  If mrc.EOF = True Then
  572.   sss = MsgBox("没有此学号!", vbExclamation + vbOKOnly, "警告")
  573.   Text2.Text = ""
  574.   Exit Sub
  575. End If
  576. Text2.Text = mrc.Fields(0)
  577.  Set mrc = Nothing
  578. Else
  579.  aaa = False
  580.  End If
  581. End Sub
  582. Private Sub Command1_Click()
  583.  For i = 0 To 13
  584.     If Trim(Text1(i).Text) = "" Then
  585.       Text1(i).Text = "0"
  586.     End If
  587.  Next i
  588.     
  589. If Combo4.Text = "" Then
  590.  sss = MsgBox("学号不能为空!", vbExclamation + vbOKOnly, "警告")
  591.  Combo4.SetFocus
  592.  Exit Sub
  593. End If
  594. Dim mrc As ADODB.Recordset
  595. txtsql = "select 学号 from cj where 学号='" & Trim(Combo4.Text) & "' and 学期='" & Trim(Combo1.Text) & "' and 类型='" & Trim(Combo3.Text) & "'"
  596.  Set mrc = ExecuteSQL(txtsql)
  597. If mrc.EOF = False Then
  598.   sss = MsgBox("已存在该学号本学期的成绩记录!", vbExclamation + vbOKOnly, "警告")
  599.      Combo4.SetFocus
  600.     Combo4.SelStart = 0
  601.     Combo4.SelLength = Len(Combo4.Text)
  602. Exit Sub
  603. End If
  604. txtsql = "select  * from cj"
  605.  Set mrc = ExecuteSQL(txtsql)
  606.  For i = 0 To (kechengcount - 1)
  607.    mrc.AddNew
  608.    mrc.Fields(0) = Trim(Combo4.Text)
  609.    mrc.Fields(1) = Trim(Combo1.Text)
  610.    mrc.Fields(2) = Trim(Combo3.Text)
  611.    mrc.Fields(3) = Trim(Label1(i).Caption)
  612.    mrc.Fields(4) = Val(Trim(Text1(i).Text))
  613.    mrc.Update
  614.  Next i
  615.  For i = 0 To 13
  616.     Text1(i).Text = "0"
  617.     Next i
  618.     Combo4.Text = ""
  619.     Text2.Text = ""
  620.     Combo4.SetFocus
  621. End Sub
  622. Private Sub Command2_Click()
  623. Unload Me
  624. End Sub
  625. Private Sub Form_Activate()
  626. List1.Visible = False
  627. Dim mrc As ADODB.Recordset
  628.  txtsql = "select  DISTINCT 班级  from class order by 班级"
  629.  Set mrc = ExecuteSQL(txtsql)
  630. mrc.MoveFirst
  631. Combo2.Clear
  632. Do While Not mrc.EOF
  633.   Combo2.AddItem mrc.Fields(0)
  634.  
  635.  mrc.MoveNext
  636.  Loop
  637.  Combo2.ListIndex = 0
  638.  
  639.  Combo1.AddItem Val(Format(Date, "yyyy")) - 1 & "---" & Val(Format(Date, "yyyy")) & "年级第一学期"
  640.  Combo1.AddItem Val(Format(Date, "yyyy")) - 1 & "---" & Val(Format(Date, "yyyy")) & "年级第二学期"
  641.  Combo1.AddItem Format(Date, "yyyy") & "---" & Val(Format(Date, "yyyy")) + 1 & "年级第一学期"
  642.  Combo1.AddItem Format(Date, "yyyy") & "---" & Val(Format(Date, "yyyy")) + 1 & "年级第二学期"
  643.  Combo1.AddItem Val(Format(Date, "yyyy")) + 1 & "---" & Val(Format(Date, "yyyy")) + 2 & "年级第一学期"
  644.   Combo1.AddItem Val(Format(Date, "yyyy")) + 1 & "---" & Val(Format(Date, "yyyy")) + 2 & "年级第二学期"
  645.  If Val(Format(Date, "mm")) > 8 Then
  646.   Combo1.ListIndex = 2
  647.  Else
  648.    Combo1.ListIndex = 1
  649. End If
  650. txtsql = "select * from kaoshileixing"
  651.   Set mrc = ExecuteSQL(txtsql)
  652.   Combo3.Clear
  653.   mrc.MoveFirst
  654.   
  655. Do While Not mrc.EOF
  656.  
  657.   Combo3.AddItem mrc.Fields(0)
  658.  
  659.  mrc.MoveNext
  660.  Loop
  661.  Combo3.ListIndex = 0
  662.  Set mrc = Nothing
  663.  fillkencheng
  664. End Sub
  665. Private Sub fillkencheng()
  666. Dim mrc As ADODB.Recordset
  667. Dim mrc1 As ADODB.Recordset
  668.  For i = 0 To 13
  669.     Label1(i).Visible = False
  670.     Text1(i).Visible = False
  671.   Next i
  672. txtsql = "select 年级,专业,年制 from class where 班级='" & Trim(Combo2.Text) & "'"
  673.  Set mrc1 = ExecuteSQL(txtsql)
  674. txtsql = "select 课程名称 from classkecheng where 学期='" & Trim(Combo1.Text) & "'and 年级='" & Trim(mrc1.Fields(0)) & "' and 专业='" & Trim(mrc1.Fields(1)) & "' and 年制='" & Trim(mrc1.Fields(2)) & "'"
  675. Set mrc1 = Nothing
  676. Set mrc = ExecuteSQL(txtsql)
  677. Dim ssss As String
  678. If mrc.EOF = True Then
  679.      sss = MsgBox("请先设置班级课程!", vbExclamation + vbOKOnly, "警告")
  680.      Command1.Enabled = False
  681.      Command2.Enabled = False
  682.      
  683.      Label1(0).Visible = False
  684.    Exit Sub
  685.  End If
  686.      Command1.Enabled = True
  687.      Command2.Enabled = True
  688.  mrc.MoveFirst
  689.     kechengcount = mrc.RecordCount
  690.   For i = 0 To (mrc.RecordCount - 1)
  691.     Label1(i).Visible = True
  692.     Text1(i).Visible = True
  693.      Label1(i).Caption = mrc.Fields(0)
  694.      Text1(i).Text = 0
  695.      mrc.MoveNext
  696.   Next i
  697.   Text1(0).SetFocus
  698.   Frame3.Height = 410 + Int(i / 2 + 0.5) * 360
  699.   Frame1.Height = 2000 + Frame3.Height
  700.   Me.Height = 1800 + Frame1.Height
  701.   Set mrc = Nothing
  702. End Sub
  703. Private Sub Form_Resize()
  704. Command1.Top = Me.Height - 800
  705. Command2.Top = Me.Height - 800
  706. End Sub
  707. Private Sub List1_Click()
  708. aaa = True
  709.  Combo4.Text = List1.List(List1.ListIndex)
  710.  
  711. End Sub
  712. Private Sub Text1_GotFocus(Index As Integer)
  713. List1.Visible = False
  714.  Text1(Index).SelStart = 0
  715.    Text1(Index).SelLength = Len(Text1(6).Text)
  716. End Sub
  717. Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
  718. Dim shao As Integer
  719. Dim zs As String
  720. If KeyAscii <> 8 And KeyAscii <> 13 Then
  721. shao = InStr(Trim(Text1(Index).Text), ".")
  722. If shao <> 0 Then
  723. zs = Right(Trim(Text1(Index).Text), Len(Trim(Text1(Index).Text)) - shao)
  724. If Len(zs) > 1 Then KeyAscii = 0
  725. End If
  726. End If
  727. If Val(Text1(Index).Text & Chr(KeyAscii)) > 100 Then
  728. KeyAscii = 0
  729.  Exit Sub
  730. End If
  731.          If KeyAscii = 13 Or KeyAscii = 46 Or KeyAscii > 47 And KeyAscii < 58 Or KeyAscii = 8 Then
  732.            Else
  733.            KeyAscii = 0
  734.           Exit Sub
  735.          End If
  736.  If KeyAscii = 13 Then
  737.  SendKeys "{TAB}"
  738.  End If
  739. End Sub