home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmNumber
- Caption = "Number System"
- Height = 3795
- Left = 2100
- LinkTopic = "Form5"
- ScaleHeight = 3390
- ScaleWidth = 4515
- Top = 1605
- Width = 4635
- Begin CommandButton cmdClose
- Caption = "&Close"
- Height = 495
- Left = 2760
- TabIndex = 4
- Top = 1920
- Width = 1215
- End
- Begin OptionButton optHexButton
- Caption = "Use &hexadecimal"
- Height = 495
- Left = 600
- TabIndex = 3
- Top = 2520
- Width = 1815
- End
- Begin OptionButton optDecButton
- Caption = "Use &decimal"
- Height = 495
- Left = 600
- TabIndex = 2
- Top = 1920
- Value = -1 'True
- Width = 1815
- End
- Begin OptionButton optOctButton
- Caption = "Use &octal"
- Height = 495
- Left = 600
- TabIndex = 1
- Top = 1320
- Width = 1815
- End
- Begin TextBox txtNumber
- Height = 375
- Left = 600
- TabIndex = 0
- Top = 600
- Width = 3375
- End
- Begin Label Label1
- Caption = "Enter a number:"
- Height = 255
- Left = 600
- TabIndex = 5
- Top = 240
- Width = 2175
- End
- Option Explicit
- Dim CurrentNum As Variant
- Sub cmdClose_Click ()
- Unload Me ' Unload this form.
- End Sub
- Sub optDecButton_Click ()
- txtNumber.Text = Format(CurrentNum)
- End Sub
- Sub optHexButton_Click ()
- txtNumber.Text = Hex(CurrentNum)
- End Sub
- Sub optOctButton_Click ()
- txtNumber.Text = Oct(CurrentNum)
- End Sub
- Sub txtNumber_Change ()
- ' Val function interprets numbers beginning with &O as octal;
- ' numbers beginning with &H as hexidecimal.
- If optOctButton.Value = True Then
- CurrentNum = Val("&O" & LTrim(txtNumber.Text) & "&")
- ElseIf optDecButton.Value = True Then
- CurrentNum = Val(LTrim(txtNumber.Text) & "&")
- Else
- CurrentNum = Val("&H" & LTrim(txtNumber.Text) & "&")
- End If
- End Sub
-