www.pudn.com > textmanager.rar > FrmShezhi.frm, change:2005-04-12,size:26412b


VERSION 5.00 
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX" 
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX" 
Begin VB.Form FrmShezhi  
   Caption         =   "考试设置" 
   ClientHeight    =   6105 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   8925 
   LinkTopic       =   "Form1" 
   LockControls    =   -1  'True 
   ScaleHeight     =   8595 
   ScaleWidth      =   11880 
   StartUpPosition =   3  '窗口缺省 
   WindowState     =   2  'Maximized 
   Begin VB.Frame Frame1  
      Height          =   7935 
      Left            =   105 
      TabIndex        =   0 
      Top             =   45 
      Width           =   11625 
      Begin VB.Frame Frame4  
         Height          =   3765 
         Left            =   3780 
         TabIndex        =   16 
         Top             =   4020 
         Width           =   7770 
         Begin VB.CommandButton CmdEnd  
            Caption         =   "收  卷" 
            Enabled         =   0   'False 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   12 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   495 
            Left            =   3735 
            TabIndex        =   26 
            Top             =   2970 
            Width           =   1335 
         End 
         Begin VB.CheckBox CheView  
            Caption         =   "(预览时显示答案)" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            ForeColor       =   &H00C00000& 
            Height          =   255 
            Left            =   1455 
            TabIndex        =   21 
            Top             =   390 
            Value           =   1  'Checked 
            Width           =   2025 
         End 
         Begin VB.CommandButton CmdView  
            Caption         =   "浏览发卷" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   12 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   495 
            Left            =   1515 
            TabIndex        =   20 
            Top             =   810 
            Width           =   1335 
         End 
         Begin VB.CommandButton Command2  
            Caption         =   "关  闭" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   12 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   495 
            Left            =   5490 
            TabIndex        =   19 
            Top             =   2955 
            Width           =   1215 
         End 
         Begin VB.CommandButton CmdStart  
            Caption         =   "开始考试" 
            Enabled         =   0   'False 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   12 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   495 
            Left            =   5235 
            TabIndex        =   18 
            Top             =   825 
            Width           =   1335 
         End 
         Begin VB.CommandButton CmdSet  
            Caption         =   "选择试卷" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   12 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   495 
            Left            =   3390 
            TabIndex        =   17 
            Top             =   825 
            Width           =   1335 
         End 
         Begin MSWinsockLib.Winsock WinS  
            Left            =   0 
            Top             =   0 
            _ExtentX        =   741 
            _ExtentY        =   741 
            _Version        =   393216 
            Protocol        =   1 
            RemoteHost      =   "pzt" 
            RemotePort      =   4001 
            LocalPort       =   4000 
         End 
      End 
      Begin VB.Frame Frame3  
         Height          =   3780 
         Left            =   3780 
         TabIndex        =   4 
         Top             =   240 
         Width           =   7755 
         Begin VB.Timer Timer1  
            Enabled         =   0   'False 
            Interval        =   1000 
            Left            =   990 
            Top             =   3315 
         End 
         Begin VB.TextBox TxTHour  
            Appearance      =   0  'Flat 
            BackColor       =   &H00E8F4F8& 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   12 
               Charset         =   134 
               Weight          =   700 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            ForeColor       =   &H00FF0000& 
            Height          =   360 
            Left            =   1770 
            TabIndex        =   7 
            Text            =   "0" 
            Top             =   1740 
            Width           =   465 
         End 
         Begin VB.TextBox TXTFen  
            Appearance      =   0  'Flat 
            BackColor       =   &H00E8F4F8& 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   12 
               Charset         =   134 
               Weight          =   700 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            ForeColor       =   &H00FF0000& 
            Height          =   360 
            Left            =   3285 
            TabIndex        =   5 
            Text            =   "0" 
            Top             =   1740 
            Width           =   420 
         End 
         Begin MSComCtl2.UpDown UDhour  
            Height          =   360 
            Left            =   2250 
            TabIndex        =   6 
            Top             =   1740 
            Width           =   270 
            _ExtentX        =   476 
            _ExtentY        =   635 
            _Version        =   393216 
            BuddyControl    =   "TxTHour" 
            BuddyDispid     =   196619 
            OrigLeft        =   5895 
            OrigTop         =   1425 
            OrigRight       =   6165 
            OrigBottom      =   1770 
            Max             =   5 
            SyncBuddy       =   -1  'True 
            BuddyProperty   =   0 
            Enabled         =   -1  'True 
         End 
         Begin MSComCtl2.UpDown UDFen  
            Height          =   360 
            Left            =   3720 
            TabIndex        =   8 
            Top             =   1740 
            Width           =   270 
            _ExtentX        =   476 
            _ExtentY        =   635 
            _Version        =   393216 
            BuddyControl    =   "TXTFen" 
            BuddyDispid     =   196620 
            OrigLeft        =   7470 
            OrigTop         =   1425 
            OrigRight       =   7740 
            OrigBottom      =   1770 
            Max             =   60 
            SyncBuddy       =   -1  'True 
            BuddyProperty   =   0 
            Enabled         =   -1  'True 
         End 
         Begin VB.Label LabNianJi  
            AutoSize        =   -1  'True 
            Caption         =   "1" 
            BeginProperty Font  
               Name            =   "楷体_GB2312" 
               Size            =   15 
               Charset         =   134 
               Weight          =   700 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            ForeColor       =   &H000000C0& 
            Height          =   300 
            Left            =   5145 
            TabIndex        =   25 
            Top             =   405 
            Width           =   180 
         End 
         Begin VB.Label Label9  
            AutoSize        =   -1  'True 
            BackStyle       =   0  'Transparent 
            Caption         =   "所属年级:" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   12 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   240 
            Left            =   4005 
            TabIndex        =   24 
            Top             =   405 
            Width           =   1080 
         End 
         Begin VB.Label LabKemu  
            AutoSize        =   -1  'True 
            Caption         =   "1" 
            BeginProperty Font  
               Name            =   "楷体_GB2312" 
               Size            =   15 
               Charset         =   134 
               Weight          =   700 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            ForeColor       =   &H000000C0& 
            Height          =   300 
            Left            =   1365 
            TabIndex        =   23 
            Top             =   390 
            Width           =   180 
         End 
         Begin VB.Label Label7  
            AutoSize        =   -1  'True 
            BackStyle       =   0  'Transparent 
            Caption         =   "所属科目:" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   12 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   240 
            Left            =   225 
            TabIndex        =   22 
            Top             =   405 
            Width           =   1080 
         End 
         Begin VB.Label Label2  
            AutoSize        =   -1  'True 
            Caption         =   "试卷标题:" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   210 
            Left            =   270 
            TabIndex        =   15 
            Top             =   1005 
            Width           =   1050 
         End 
         Begin VB.Label LabTitle  
            AutoSize        =   -1  'True 
            Caption         =   "没有试卷" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   12 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            ForeColor       =   &H00FF0000& 
            Height          =   240 
            Left            =   1305 
            TabIndex        =   14 
            Top             =   975 
            Width           =   960 
         End 
         Begin VB.Label Label3  
            AutoSize        =   -1  'True 
            Caption         =   "考试剩余时间:" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   210 
            Left            =   750 
            TabIndex        =   13 
            Top             =   2745 
            Width           =   1470 
         End 
         Begin VB.Label LabTime  
            AutoSize        =   -1  'True 
            BackColor       =   &H00808080& 
            BackStyle       =   0  'Transparent 
            Caption         =   "00:00:00" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   24 
               Charset         =   134 
               Weight          =   700 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            ForeColor       =   &H000000FF& 
            Height          =   495 
            Left            =   2265 
            TabIndex        =   12 
            Top             =   2595 
            Width           =   2055 
         End 
         Begin VB.Label Label4  
            AutoSize        =   -1  'True 
            Caption         =   "考试时间设置:" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   210 
            Left            =   660 
            TabIndex        =   11 
            Top             =   1455 
            Width           =   1470 
         End 
         Begin VB.Label Label5  
            AutoSize        =   -1  'True 
            Caption         =   "小时" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   210 
            Left            =   2685 
            TabIndex        =   10 
            Top             =   1800 
            Width           =   690 
         End 
         Begin VB.Label Label6  
            AutoSize        =   -1  'True 
            Caption         =   "分钟" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   210 
            Left            =   4200 
            TabIndex        =   9 
            Top             =   1800 
            Width           =   420 
         End 
      End 
      Begin VB.Frame Frame2  
         Height          =   7560 
         Left            =   180 
         TabIndex        =   1 
         Top             =   225 
         Width           =   3510 
         Begin VB.ListBox LstTest  
            Appearance      =   0  'Flat 
            BackColor       =   &H00E8F4F8& 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   12 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   6510 
            Left            =   285 
            TabIndex        =   2 
            Top             =   780 
            Width           =   3015 
         End 
         Begin VB.Label Label1  
            AutoSize        =   -1  'True 
            Caption         =   "所有生成的试卷:" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   12 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   240 
            Left            =   150 
            TabIndex        =   3 
            Top             =   315 
            Width           =   1920 
         End 
      End 
   End 
End 
Attribute VB_Name = "FrmShezhi" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
'定义一个数组来保存对应试卷的id 
Dim TestIdArr() As Long 
Dim CountSec As Long '考试的总秒数 
 
Private Sub CmdEnd_Click() 
  If CountSec > 0 Then 
     If MsgBox("收卷时间没到,你真的要提前收卷吗?", vbYesNo, "提问") = vbYes Then 
        DB.Execute "delete from kaoshixinxi" 
        CmdSet.Enabled = True 
        CmdStart.Enabled = True 
        CmdEnd.Enabled = False 
        Timer1.Enabled = False 
        LabTime.Caption = "00:00:00" 
        CountSec = 0 
     End If 
  End If 
End Sub 
 
Private Sub CmdSet_Click() 
Dim TimeStr As String 
 '提交 
If LstTest.ListIndex < 0 Then 
MsgBox "请选择考试的试卷名称", vbExclamation, "提示" 
Exit Sub 
End If 
'判断是否设置考试时间 
If TxTHour.Text = 0 And TXTFen.Text = 0 Then 
   MsgBox "请先设置考试总时间!" 
   Exit Sub 
End If 
'询问是否真的设置这个时间 
TimeStr = Format(TxTHour.Text, "00") + ":" + Format(TXTFen.Text, "00") + ":" + "00" 
If MsgBox("你设置的考试总时间为:" + TimeStr + ",你真的继续吗?", vbYesNo, "提示!") = vbNo Then 
   Exit Sub 
End If 
 
'提问是不是真的发卷 
If MsgBox("你真的要选择该卷吗?", vbYesNo, "问题!") = vbNo Then 
   Exit Sub 
End If 
Dim sql As String 
Dim TempRs As Recordset 
Set TempRs = New Recordset 
sql = "select * from test where title='" & LstTest.List(LstTest.ListIndex) & "' and id=" + str(TestIdArr(LstTest.ListIndex)) 
 
TempRs.Open sql, DB, adOpenStatic, adLockOptimistic 
 
Dim sql1 As String 
sql1 = "delete from kaoshixinxi" 
DB.Execute sql1 
 
Dim xinxiRS As Recordset 
Set xinxiRS = New Recordset 
xinxiRS.Open "kaoshixinxi", DB, adOpenStatic, adLockOptimistic 
xinxiRS.AddNew 
xinxiRS.Fields("id") = TempRs.Fields("ID").Value 
xinxiRS.Fields("kemuid") = TempRs.Fields("kemuid").Value 
xinxiRS.Fields("nianjiid") = TempRs.Fields("nianjiid").Value 
xinxiRS.Fields("title") = TempRs.Fields("title").Value 
xinxiRS.Fields("danxuan") = TempRs.Fields("danxuan").Value 
xinxiRS.Fields("duoxuan") = TempRs.Fields("duoxuan").Value 
xinxiRS.Fields("danxuans") = TempRs.Fields("danxuans").Value 
xinxiRS.Fields("duoxuans") = TempRs.Fields("duoxuans").Value 
 
xinxiRS.Fields("tiankong") = TempRs.Fields("tiankong").Value 
xinxiRS.Fields("panduan") = TempRs.Fields("panduan").Value 
xinxiRS.Fields("tiankongs") = TempRs.Fields("tiankongs").Value 
xinxiRS.Fields("panduans") = TempRs.Fields("panduans").Value 
 
xinxiRS.Fields("wenda") = TempRs.Fields("wenda").Value 
xinxiRS.Fields("zuowen") = TempRs.Fields("zuowen").Value 
xinxiRS.Fields("wendas") = TempRs.Fields("wendas").Value 
xinxiRS.Fields("zuowens") = TempRs.Fields("zuowens").Value 
 
xinxiRS.Fields("zscore").Value = TempRs.Fields("zscore").Value 
xinxiRS.Fields("start").Value = "F" 
xinxiRS.Fields("ctime").Value = Time2Sec(TimeStr) 
xinxiRS.Update 
 
xinxiRS.Close 
CountSec = Time2Sec(TimeStr) 
Set xinxiRS = Nothing 
TempRs.Close 
Set TempRs = Nothing 
MsgBox "试卷成功发送完成!你可以按<开始考试>设置考试端开始考试!" 
CmdSet.Enabled = False 
CmdStart.Enabled = True 
End Sub 
 
 
Private Sub CmdStart_Click() 
 '开始到记时 
 If MsgBox("一旦开始考试以后只有等到考试结束以后才能退出该模块,你是否真的确定?", vbYesNo + 48, "问题") = vbYes Then 
   Timer1.Enabled = True 
   DB.Execute "update kaoshixinxi set start='T'" 
   CmdStart.Enabled = False 
   CmdEnd.Enabled = True 
 End If 
End Sub 
 
Private Sub CmdView_Click() 
If LstTest.ListIndex < 0 Then 
  MsgBox "请选择考试的试卷名称", vbExclamation, "提示" 
  Exit Sub 
End If 
Dim sql As String 
Dim adoRs As Recordset 
Dim strid As String '题目 ID 
Dim adoTMRs As Recordset 
Dim adoTMRsd As Recordset 
Dim adoTMTK As Recordset 
Dim adoTMPD As Recordset 
Dim adoTMWD As Recordset 
Dim adoTMZW As Recordset 
 
Dim sqld As String 
'查询试卷 
Set adoRs = New Recordset 
sql = "select * from test where title='" & LstTest.List(LstTest.ListIndex) & "' and id=" + str(TestIdArr(LstTest.ListIndex)) 
adoRs.Open sql, DB, adOpenStatic, adLockOptimistic 
'预览试卷 
'单选 
strid = adoRs.Fields("danxuan").Value 
If strid = "" Then strid = "0" 
Set adoTMRs = New Recordset 
sql = "select * from question where id in (" + strid + ")" ' 
adoTMRs.Open sql, DB, adOpenStatic, adLockOptimistic 
'多选 
strid = adoRs.Fields("duoxuan").Value 
If strid = "" Then strid = "0" 
Set adoTMRsd = New Recordset 
sqld = "select * from question where id in (" + strid + ") " 
adoTMRsd.Open sqld, DB, adOpenStatic, adLockOptimistic 
'填空 
strid = adoRs.Fields("tiankong").Value 
If strid = "" Then strid = "0" 
Set adoTMTK = New Recordset 
sqld = "select * from questionTK where id in (" + strid + ") " 
adoTMTK.Open sqld, DB, adOpenStatic, adLockOptimistic 
'判断 
strid = adoRs.Fields("panduan").Value 
If strid = "" Then strid = "0" 
Set adoTMPD = New Recordset 
sqld = "select * from questionPD where id in (" + strid + ") " 
adoTMPD.Open sqld, DB, adOpenStatic, adLockOptimistic 
'问答 
strid = adoRs.Fields("wenda").Value 
If strid = "" Then strid = "0" 
Set adoTMWD = New Recordset 
sqld = "select * from questionWD where id in (" + strid + ") " 
adoTMWD.Open sqld, DB, adOpenStatic, adLockOptimistic 
'作文 
strid = adoRs.Fields("zuowen").Value 
If strid = "" Then strid = "0" 
Set adoTMZW = New Recordset 
sqld = "select * from questionZW where id in (" + strid + ") " 
adoTMZW.Open sqld, DB, adOpenStatic, adLockOptimistic 
 
'生成HTML文件 
Dim DaView As Boolean 
DaView = False 
If CheView = 1 Then 
   DaView = True 
End If 
CreateHTML App.Path + "\temp.html", LstTest.List(LstTest.ListIndex), DaView, adoTMRs, adoTMRsd, adoTMTK, adoTMPD, adoTMWD, adoTMZW 
   'FrmView.Web.LocationURL = App.Path + "\temp.html" 
   Set adoTMRs = Nothing 
   Set adoTMRsd = Nothing 
   Set adoTMTK = Nothing 
   Set adoTMPD = Nothing 
   Set adoTMWD = Nothing 
   Set adoTMZW = Nothing 
FrmView.Web.Navigate App.Path + "\temp.html" 
FrmView.Show 1 
End Sub 
 
 
 
Private Sub Command2_Click() 
  
 Unload Me 
End Sub 
 
Private Sub Form_Load() 
Dim IdCount As Integer 
 
'取得全部试卷 
Dim Qurs As ADODB.Recordset 
Set Qurs = New Recordset 
Qurs.Open "select id,title from test where kemuid=" & UseKeMuID & " and nianjiid=" & UseNianJiID, DB, adOpenStatic, adLockOptimistic 
IdCount = 0 
If Not Qurs.EOF Then 
  Qurs.MoveLast 
  Qurs.MoveFirst 
  IdCount = Qurs.RecordCount 
  ReDim TestIdArr(IdCount) As Long 
  IdCount = -1 
  Do While Not Qurs.EOF 
    IdCount = IdCount + 1 
    LstTest.AddItem Qurs.Fields("title").Value 
    TestIdArr(IdCount) = Qurs.Fields("id").Value 
    Qurs.MoveNext 
  Loop 
  LstTest.ListIndex = 0 
Else 
  MsgBox "还没有生成试卷,请先生成试卷!" 
End If 
  Qurs.Close 
  Set Qurs = Nothing 
End Sub 
 
Private Sub Form_Resize() 
   
    FrmMain.WindowState = Me.WindowState 
End Sub 
 
Private Sub Form_Unload(Cancel As Integer) 
  '表示正在考试 
 If CmdStart.Enabled = False And CmdSet.Enabled = False Then 
    MsgBox "现在正在考试,不能退出考试控制界面!" 
    Cancel = 1 
 End If 
 If CmdSet.Enabled = False Then 
    If MsgBox("你已经发了卷,你真的要退出吗?", vbYesNo, "提问!") = vbYes Then 
      '删除数据库 
      DB.Execute "delete from kaoshixinxi" 
     Else 
      Cancel = 1 
     End If 
 End If 
End Sub 
 
Private Sub LstTest_Click() 
 LabTitle.Caption = LstTest.List(LstTest.ListIndex) 
End Sub 
 
Private Sub Timer1_Timer() 
 CountSec = CountSec - 1 
 LabTime.Caption = Sec2Time(CountSec) 
 If CountSec <= 0 Then 
    Timer1.Enabled = False 
    MsgBox "交卷时间到!!" 
     
 End If 
End Sub 
 
Private Sub TXTFen_Change() 
   LabTime.Caption = Format(TxTHour.Text, "00") + ":" + Format(TXTFen.Text, "00") + ":60" 
End Sub 
 
Private Sub TXTFen_KeyPress(KeyAscii As Integer) 
 If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 46) Then 
  KeyAscii = 0 
 End If 
 
End Sub 
 
Private Sub TxTHour_Change() 
   LabTime.Caption = Format(TxTHour.Text, "00") + ":" + Format(TXTFen.Text, "00") + ":00" 
End Sub 
 
Private Sub TxTHour_KeyPress(KeyAscii As Integer) 
  If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 46) Then 
  KeyAscii = 0 
 End If 
 
End Sub