home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Main
- BackColor = &H00E0E0E0&
- Caption = "BaseConvert"
- ClientHeight = 3030
- ClientLeft = 2925
- ClientTop = 1800
- ClientWidth = 3075
- Height = 3720
- Icon = BASECVT1.FRX:0000
- Left = 2865
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 3030
- ScaleWidth = 3075
- Top = 1170
- Width = 3195
- Begin TextBox UserInput
- Height = 375
- Left = 960
- TabIndex = 1
- Top = 1800
- Width = 1215
- End
- Begin CommandButton Command1
- Caption = "Another"
- Height = 615
- Left = 240
- TabIndex = 7
- Top = 720
- Width = 1215
- End
- Begin ComboBox BaseList
- Height = 300
- Left = 1920
- Style = 2 'Dropdown List
- TabIndex = 0
- Top = 480
- Width = 975
- End
- Begin CommandButton ConvertCmd
- Caption = "Convert"
- Default = -1 'True
- Height = 615
- Left = 240
- TabIndex = 6
- Top = 120
- Width = 1215
- End
- Begin Label Answer
- Alignment = 2 'Center
- BorderStyle = 1 'Fixed Single
- ForeColor = &H000000FF&
- Height = 345
- Left = 240
- TabIndex = 4
- Top = 2520
- Width = 2625
- End
- Begin Label Label2
- BackColor = &H00FFFFFF&
- BorderStyle = 1 'Fixed Single
- Caption = "New Number"
- Height = 255
- Left = 960
- TabIndex = 3
- Top = 2280
- Width = 1215
- End
- Begin Label Label1
- BorderStyle = 1 'Fixed Single
- Caption = "Your Number"
- Height = 255
- Left = 960
- TabIndex = 2
- Top = 1560
- Width = 1215
- End
- Begin Label Label3
- BorderStyle = 1 'Fixed Single
- Caption = "New Base"
- Height = 255
- Left = 1920
- TabIndex = 5
- Top = 240
- Width = 975
- End
- Begin Menu Filemenu
- Caption = "File"
- Begin Menu AboutMenu
- Caption = "About"
- End
- Begin Menu HelpMenu
- Caption = "Help"
- End
- Begin Menu separator
- Caption = "-"
- End
- Begin Menu ExitMenu
- Caption = "Exit"
- End
- End
- Sub AboutMenu_Click ()
- aboutform.Show
- End Sub
- Sub BaseList_Click ()
- userinput.SetFocus
- End Sub
- Sub BaseList_GotFocus ()
- Static flag%
- If flag% = 0 Then
- baselist.AddItem Str$(2)
- baselist.AddItem Str$(3)
- baselist.AddItem Str$(4)
- baselist.AddItem Str$(5)
- baselist.AddItem Str$(6)
- baselist.AddItem Str$(7)
- baselist.AddItem Str$(8)
- baselist.AddItem Str$(9)
- baselist.AddItem Str$(16)
- End If
- flag% = 1
- End Sub
- Sub Command1_Click ()
- userinput.text = ""
- answer.caption = ""
- userinput.SetFocus
- End Sub
- Sub convertcmd_click ()
- userinput.SetFocus
- Static n&, b%, R&, I%, Q&, C%, Limit%
- I% = 1 'array digitcounter
- Limit% = 100' array size
- ReDim RR(1 To Limit%) As Integer
- n& = Val(userinput.text)
- b% = Val(baselist.text)
- ans$ = ""
- If b% <> 16 Then
- While (n& <> 0) 'start base conversion
- R& = n& Mod b%
- RR(I%) = R&
- I% = I% + 1
- Q& = n& \ b%
- n& = Q&
- Wend
- I% = I% - 1'set counter to correct number
- For C% = 1 To I% 'read array
- ans$ = LTrim$(Str$(RR(C%)) + ans$)
- Next
- answer.caption = ans$
- Else
- answer.caption = Hex$(n&)
- End If
- End Sub
- Sub ExitMenu_Click ()
- End
- End Sub
- Sub HelpMenu_Click ()
- help.Show
- End Sub
- Sub UserInput_Change ()
- msg$ = "Your number is restricted" + Chr$(13) + Chr$(10) + "to a maximum of 8 digits."
- title$ = "Entry Error"
- If Len(userinput.text) > 8 Then
- MsgBox msg$, 64, title$
- userinput.text = ""
- End If
- End Sub
- Sub UserInput_KeyPress (keyascii As Integer)
- A% = keyascii
- If A% < 47 Or A% > 58 Then ' integers 0 thru 9
- keyascii = 0
- msg$ = "Enter Postive Numbers Only"
- title$ = "Entry Error"
- MsgBox (msg$), 48, title$
- End If
- End Sub
-