home *** CD-ROM | disk | FTP | other *** search
/ On Hand / On_Hand_From_Softbank_1994_Release_2_Disc_2_1994.iso / 00202 / s / disk1 / number.fr_ / number.bin
Text File  |  1993-04-28  |  3KB  |  104 lines

  1. VERSION 2.00
  2. Begin Form frmNumber 
  3.    Caption         =   "Number System"
  4.    ClientHeight    =   3390
  5.    ClientLeft      =   2160
  6.    ClientTop       =   1950
  7.    ClientWidth     =   4515
  8.    Height          =   3795
  9.    Left            =   2100
  10.    LinkTopic       =   "Form5"
  11.    ScaleHeight     =   3390
  12.    ScaleWidth      =   4515
  13.    Top             =   1605
  14.    Width           =   4635
  15.    Begin CommandButton cmdClose 
  16.       Caption         =   "&Close"
  17.       Height          =   495
  18.       Left            =   2760
  19.       TabIndex        =   4
  20.       Top             =   1920
  21.       Width           =   1215
  22.    End
  23.    Begin OptionButton optHexButton 
  24.       Caption         =   "Use &hexadecimal"
  25.       Height          =   495
  26.       Left            =   600
  27.       TabIndex        =   3
  28.       Top             =   2520
  29.       Width           =   1815
  30.    End
  31.    Begin OptionButton optDecButton 
  32.       Caption         =   "Use &decimal"
  33.       Height          =   495
  34.       Left            =   600
  35.       TabIndex        =   2
  36.       Top             =   1920
  37.       Value           =   -1  'True
  38.       Width           =   1815
  39.    End
  40.    Begin OptionButton optOctButton 
  41.       Caption         =   "Use &octal"
  42.       Height          =   495
  43.       Left            =   600
  44.       TabIndex        =   1
  45.       Top             =   1320
  46.       Width           =   1815
  47.    End
  48.    Begin TextBox txtNumber 
  49.       Height          =   375
  50.       Left            =   600
  51.       TabIndex        =   0
  52.       Top             =   600
  53.       Width           =   3375
  54.    End
  55.    Begin Label Label1 
  56.       Caption         =   "Enter a number:"
  57.       Height          =   255
  58.       Left            =   600
  59.       TabIndex        =   5
  60.       Top             =   240
  61.       Width           =   2175
  62.    End
  63. End
  64. Option Explicit
  65. Dim CurrentNum As Variant
  66.  
  67. Sub cmdClose_Click ()
  68.    Unload Me    ' Unload this form.
  69. End Sub
  70.  
  71. Sub optDecButton_Click ()
  72.     txtNumber.Text = Format(CurrentNum)
  73. End Sub
  74.  
  75. Sub optHexButton_Click ()
  76.     txtNumber.Text = Hex(CurrentNum)
  77. End Sub
  78.  
  79. Sub optOctButton_Click ()
  80.     txtNumber.Text = Oct(CurrentNum)
  81. End Sub
  82.  
  83. Sub txtNumber_Change ()
  84. ' Val function interprets numbers beginning with &O as octal;
  85. ' numbers beginning with &H as hexidecimal.
  86.     If optOctButton.Value = True Then
  87.         CurrentNum = Val("&O" & LTrim(txtNumber.Text) & "&")
  88.     ElseIf optDecButton.Value = True Then
  89.         CurrentNum = Val(LTrim(txtNumber.Text) & "&")
  90.     Else
  91.         CurrentNum = Val("&H" & LTrim(txtNumber.Text) & "&")
  92.     End If
  93. End Sub
  94.  
  95. Sub txtNumber_KeyPress (KeyAscii As Integer)
  96.      ' This code prevents the user from entering
  97.      ' a negative number, or a decimal point.
  98.      If KeyAscii < 48 Or KeyAscii > 57 Then
  99.         KeyAscii = 0
  100.         Beep
  101.      End If
  102. End Sub
  103.  
  104.