home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 17 / IOPROG_17.ISO / soft / msmeg2.exe / DFINFOS2.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-09-23  |  6.2 KB  |  214 lines

  1. VERSION 4.00
  2. Begin VB.Form ConvDFInfoS2 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Convert 24hr to 12hr"
  5.    ClientHeight    =   2550
  6.    ClientLeft      =   2460
  7.    ClientTop       =   2595
  8.    ClientWidth     =   4125
  9.    BeginProperty Font 
  10.       name            =   "MS Sans Serif"
  11.       charset         =   1
  12.       weight          =   700
  13.       size            =   8.25
  14.       underline       =   0   'False
  15.       italic          =   0   'False
  16.       strikethrough   =   0   'False
  17.    EndProperty
  18.    ForeColor       =   &H80000008&
  19.    Height          =   2955
  20.    Left            =   2400
  21.    LinkTopic       =   "Form1"
  22.    ScaleHeight     =   2550
  23.    ScaleWidth      =   4125
  24.    Top             =   2250
  25.    Width           =   4245
  26.    Begin VB.CommandButton btnExit 
  27.       Cancel          =   -1  'True
  28.       Caption         =   "Exit"
  29.       BeginProperty Font 
  30.          name            =   "MS Sans Serif"
  31.          charset         =   0
  32.          weight          =   400
  33.          size            =   8.25
  34.          underline       =   0   'False
  35.          italic          =   0   'False
  36.          strikethrough   =   0   'False
  37.       EndProperty
  38.       Height          =   375
  39.       Left            =   2520
  40.       TabIndex        =   6
  41.       Top             =   600
  42.       Width           =   1335
  43.    End
  44.    Begin VB.TextBox txt12Hour 
  45.       BeginProperty Font 
  46.          name            =   "MS Sans Serif"
  47.          charset         =   0
  48.          weight          =   400
  49.          size            =   8.25
  50.          underline       =   0   'False
  51.          italic          =   0   'False
  52.          strikethrough   =   0   'False
  53.       EndProperty
  54.       Height          =   285
  55.       Left            =   240
  56.       TabIndex        =   3
  57.       Text            =   "txt12Hour"
  58.       Top             =   960
  59.       Width           =   1935
  60.    End
  61.    Begin VB.TextBox txt24Hour 
  62.       BeginProperty Font 
  63.          name            =   "MS Sans Serif"
  64.          charset         =   0
  65.          weight          =   400
  66.          size            =   8.25
  67.          underline       =   0   'False
  68.          italic          =   0   'False
  69.          strikethrough   =   0   'False
  70.       EndProperty
  71.       Height          =   285
  72.       Left            =   240
  73.       TabIndex        =   1
  74.       Text            =   "txt24Hour"
  75.       Top             =   360
  76.       Width           =   1935
  77.    End
  78.    Begin VB.CommandButton btnConvert 
  79.       Caption         =   "Convert"
  80.       Default         =   -1  'True
  81.       BeginProperty Font 
  82.          name            =   "MS Sans Serif"
  83.          charset         =   0
  84.          weight          =   400
  85.          size            =   8.25
  86.          underline       =   0   'False
  87.          italic          =   0   'False
  88.          strikethrough   =   0   'False
  89.       EndProperty
  90.       Height          =   375
  91.       Left            =   2520
  92.       TabIndex        =   0
  93.       Top             =   120
  94.       Width           =   1335
  95.    End
  96.    Begin VB.Label Label3 
  97.       Caption         =   $"DFINFOS2.frx":0000
  98.       BeginProperty Font 
  99.          name            =   "MS Sans Serif"
  100.          charset         =   0
  101.          weight          =   400
  102.          size            =   8.25
  103.          underline       =   0   'False
  104.          italic          =   0   'False
  105.          strikethrough   =   0   'False
  106.       EndProperty
  107.       Height          =   855
  108.       Left            =   240
  109.       TabIndex        =   5
  110.       Top             =   1440
  111.       Width           =   3615
  112.    End
  113.    Begin VB.Label Label2 
  114.       Caption         =   "12 Hour Time:"
  115.       BeginProperty Font 
  116.          name            =   "MS Sans Serif"
  117.          charset         =   0
  118.          weight          =   400
  119.          size            =   8.25
  120.          underline       =   0   'False
  121.          italic          =   0   'False
  122.          strikethrough   =   0   'False
  123.       EndProperty
  124.       Height          =   255
  125.       Left            =   240
  126.       TabIndex        =   4
  127.       Top             =   720
  128.       Width           =   1455
  129.    End
  130.    Begin VB.Label Label1 
  131.       Caption         =   "24 Hour Time:"
  132.       BeginProperty Font 
  133.          name            =   "MS Sans Serif"
  134.          charset         =   0
  135.          weight          =   400
  136.          size            =   8.25
  137.          underline       =   0   'False
  138.          italic          =   0   'False
  139.          strikethrough   =   0   'False
  140.       EndProperty
  141.       Height          =   255
  142.       Left            =   240
  143.       TabIndex        =   2
  144.       Top             =   120
  145.       Width           =   1455
  146.    End
  147. Attribute VB_Name = "ConvDFInfoS2"
  148. Attribute VB_Creatable = False
  149. Attribute VB_Exposed = False
  150. Option Explicit
  151. Private Sub btnConvert_Click()
  152.     Dim TempStr As String
  153.     '
  154.     ' get the time the user entered and convert it
  155.     '
  156.     TempStr = txt24Hour
  157.     txt12Hour = ConvertDFInfoS2(TempStr)
  158. End Sub
  159. Private Sub btnExit_Click()
  160.     '
  161.     ' get out
  162.     '
  163.     End
  164. End Sub
  165. ' this function requires the data is valid and in the
  166. ' format of HH:MM:SS.  It does no error checking.
  167. Private Function ConvertDFInfoS2(TimeString As String) As String
  168.     Dim OutString As String
  169.     Dim TimeHour As Integer
  170.     '
  171.     ' get hour
  172.     '
  173.     TimeHour = Val(Left(TimeString, 2))
  174.     '
  175.     ' format first part of string, make sure 00:00:00
  176.     ' is formatted as 12:00:00
  177.     '
  178.     If (TimeHour Mod 12) = 0 Then
  179.         OutString = "12" & Mid(TimeString, 3)
  180.     Else
  181.         OutString = Format(TimeHour Mod 12, "00") & Mid(TimeString, 3)
  182.     End If
  183.     '
  184.     ' check for AM/PM
  185.     '
  186.     If TimeHour < 12 Then
  187.         OutString = OutString & " AM"
  188.     Else
  189.         OutString = OutString & " PM"
  190.     End If
  191.     '
  192.     ' return new time
  193.     '
  194.     ConvertDFInfoS2 = OutString
  195. End Function
  196. Private Sub Form_Load()
  197.     Dim TempStr As String
  198.     '
  199.     ' initialize 24 hour text box
  200.     '
  201.     txt24Hour = Format(Now, "hh:mm:ss")
  202.     '
  203.     ' get 24 hour formatted time and convert it to 12 hour
  204.     '
  205.     TempStr = txt24Hour
  206.     txt12Hour = ConvertDFInfoS2(TempStr)
  207. End Sub
  208. Private Sub Form_Unload(Cancel As Integer)
  209.     '
  210.     ' make sure we get out
  211.     '
  212.     End
  213. End Sub
  214.