home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l406 / 1.ddi / NUMBER.FR_ / NUMBER.bin (.txt)
Encoding:
Visual Basic Form  |  1992-10-21  |  2.4 KB  |  84 lines

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