home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / PVb5.0 / VB / SAMPLES / PGUIDE / VCR / SET.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-01-27  |  6.4 KB  |  216 lines

  1. VERSION 5.00
  2. Begin VB.Form frmSetTime 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "
  5.    ClientHeight    =   2760
  6.    ClientLeft      =   780
  7.    ClientTop       =   1590
  8.    ClientWidth     =   5175
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   2760
  13.    ScaleWidth      =   5175
  14.    ShowInTaskbar   =   0   'False
  15.    Begin VB.CommandButton cmdCancel 
  16.       Cancel          =   -1  'True
  17.       Caption         =   "
  18.       Height          =   495
  19.       Left            =   3360
  20.       MaskColor       =   &H00000000&
  21.       TabIndex        =   7
  22.       Top             =   1200
  23.       Width           =   1215
  24.    End
  25.    Begin VB.CommandButton cmdOK 
  26.       Caption         =   "
  27.       Default         =   -1  'True
  28.       Height          =   495
  29.       Left            =   3360
  30.       MaskColor       =   &H00000000&
  31.       TabIndex        =   6
  32.       Top             =   480
  33.       Width           =   1215
  34.    End
  35.    Begin VB.TextBox txtChannel 
  36.       Height          =   375
  37.       Left            =   1200
  38.       TabIndex        =   5
  39.       Text            =   "3"
  40.       ToolTipText     =   "
  41.       Top             =   1920
  42.       Width           =   615
  43.    End
  44.    Begin VB.TextBox txtEnd 
  45.       Height          =   375
  46.       Left            =   1200
  47.       TabIndex        =   4
  48.       Text            =   "12:30 AM"
  49.       ToolTipText     =   "
  50.       Top             =   1200
  51.       Width           =   1215
  52.    End
  53.    Begin VB.TextBox txtStart 
  54.       Height          =   375
  55.       Left            =   1200
  56.       TabIndex        =   3
  57.       Text            =   "12:00 AM"
  58.       ToolTipText     =   "
  59.       Top             =   480
  60.       Width           =   1215
  61.    End
  62.    Begin VB.Label lblCaption 
  63.       Alignment       =   1  'Right Justify
  64.       Caption         =   "
  65.       Height          =   255
  66.       Index           =   2
  67.       Left            =   0
  68.       TabIndex        =   2
  69.       Top             =   2040
  70.       Width           =   1095
  71.    End
  72.    Begin VB.Label lblCaption 
  73.       Alignment       =   1  'Right Justify
  74.       Caption         =   "
  75.       Height          =   255
  76.       Index           =   1
  77.       Left            =   0
  78.       TabIndex        =   1
  79.       Top             =   1320
  80.       Width           =   1095
  81.    End
  82.    Begin VB.Label lblCaption 
  83.       Alignment       =   1  'Right Justify
  84.       Caption         =   "
  85.       Height          =   255
  86.       Index           =   0
  87.       Left            =   0
  88.       TabIndex        =   0
  89.       Top             =   600
  90.       Width           =   1095
  91.    End
  92. Attribute VB_Name = "frmSetTime"
  93. Attribute VB_GlobalNameSpace = False
  94. Attribute VB_Creatable = False
  95. Attribute VB_PredeclaredId = True
  96. Attribute VB_Exposed = False
  97. '**********************************************
  98. '         
  99. '         
  100.  VCR 
  101. '**********************************************
  102. Option Explicit
  103. Private Sub cmdCancel_Click()
  104.     ' 
  105.     Unload Me
  106.     Set frmSetTime = Nothing
  107. End Sub
  108. Private Sub cmdOK_Click()
  109.     Dim intOK As Integer        '
  110.     Dim intChannel As Integer   '
  111.     Dim strMsg As String        '
  112.     ' 
  113.     intOK = ValidateTime(txtStart.Text, txtStart)
  114.     ' 
  115.     If intOK = False Then Exit Sub
  116.         
  117.     ' 
  118.     intOK = ValidateTime(txtEnd.Text, txtEnd)
  119.     ' 
  120.     If intOK = False Then Exit Sub
  121.     ' 
  122.     intChannel = Val(txtChannel)
  123.     ' 
  124.     If intChannel < 2 Or intChannel > 13 Then
  125.         strMsg = "
  126.         MsgBox strMsg, vbOKOnly, "
  127.         txtChannel.SetFocus
  128.         Exit Sub
  129.     End If
  130.     ' 
  131.  Recorder 
  132.     Recorder.StartRecording = CVar(txtStart.Text)
  133.     Recorder.StopRecording = CVar(txtEnd.Text)
  134.     Recorder.Channel = intChannel
  135.         
  136.     ' 
  137.     Unload Me
  138.     Set frmSetTime = Nothing
  139. End Sub
  140. Private Sub Form_Load()
  141.     ' 
  142.     ' 
  143.  TextBox
  144.     If Recorder.StartRecording <> Empty Then
  145.         txtStart.Text = Recorder.StartRecording
  146.     End If
  147.     If Recorder.StopRecording <> Empty Then
  148.         txtEnd.Text = Recorder.StopRecording
  149.     End If
  150.     txtChannel = Recorder.Channel
  151. End Sub
  152. '**********************************************
  153. '         
  154. '         
  155.   Time
  156. '         Field
  157.   True - 
  158. '         False - 
  159. '**********************************************
  160. Function ValidateTime(Time As String, Field As Control) As Boolean
  161.     Dim strMsg As String    ' 
  162.     ' 
  163.  IsDate 
  164.     If IsDate(Time) Then
  165.         ' 
  166.  True
  167.         Field.Text = Format$(Time, "h:mm AM/PM")
  168.         ValidateTime = True
  169.     Else
  170.         ' 
  171.         strMsg = "
  172.         strMsg = strMsg & "(
  173.  AM/PM)"
  174.         MsgBox strMsg, vbOKOnly, "
  175.         ' 
  176.         Field.SetFocus
  177.         ' 
  178.  False 
  179.         ValidateTime = False
  180.     End If
  181. End Function
  182. Private Sub txtChannel_GotFocus()
  183.     ' 
  184.     txtChannel.SelStart = 0
  185.     txtChannel.SelLength = Len(txtChannel.Text)
  186. End Sub
  187. Private Sub txtChannel_KeyPress(KeyAscii As Integer)
  188.     ' 
  189.  IsNumeric 
  190.     If Not IsNumeric(Chr(KeyAscii)) Then
  191.         ' 
  192.  null
  193.         KeyAscii = 0
  194.     End If
  195. End Sub
  196. Private Sub txtEnd_GotFocus()
  197.     ' 
  198.     txtEnd.SelStart = 0
  199.     txtEnd.SelLength = Len(txtEnd.Text)
  200. End Sub
  201. Private Sub txtEnd_LostFocus()
  202.     Dim intOK As Integer    ' 
  203.     ' 
  204.     intOK = ValidateTime(txtEnd.Text, txtEnd)
  205. End Sub
  206. Private Sub txtStart_GotFocus()
  207.     ' 
  208.     txtStart.SelStart = 0
  209.     txtStart.SelLength = Len(txtStart.Text)
  210. End Sub
  211. Private Sub txtStart_LostFocus()
  212.     Dim intOK As Integer    '
  213.     ' 
  214.     intOK = ValidateTime(txtStart.Text, txtStart)
  215. End Sub
  216.