A+ code: convert numbers to and from decimal, hexadecimal and octal
This code will convert numbers to and from decimal, hexadecimal and octal. It's really useful and simple to follow code - intended for the beginner. If you use it, there's no need to give me credit but lease vote for it, thanks. -lgr
AI
สรุปโดย AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
ซอร์สโค้ด
'Written by littlegreenrussian
Sub optDecimalButton_click() 'decimal checkbox clicked
txtNumber.Text = Format(CurrentNum) 'change the format of the txtHumber textbox
End Sub
Sub optHexButton_click() 'hexadecimal checkbox clicked
txtNumber.Text = Format(CurrentNum) 'change the format of the txtHumber textbox
End Sub
Sub optOctalButton_click() 'octalcheckbox clicked
txtNumber.Text = Format(CurrentNum) 'change the format of the txtHumber textbox
End Sub
SubtxtNumber_Change()
'Val function - numbers beginning with &O as octal,
'numbers beginning with &H as hexadecimal
If optOctalButton.Value = True Then 'octal button checked
CurrentNum = Val("&O" & LTrim(txtNumber.Text)& "&") 'change the number to octal
Else if optDecimal.Value = True Then 'decimal checked
CurrentNum = Val(LTrim(txtNumber.Text)& "&") 'change number to deciaml - note it does NOT require a &D
Else 'otherwise
CurrentNum = Val("&H" & LTrim(txtNumber.Text)& "&") 'change it to hexadecimal
End If
End Sub
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine