Private Sub Command1_Click()
y = Val(InputBox("請輸入要轉換為二進制的十進制數字:"))
If 0 <= y And y <= 255 Then
Do
m = y Mod 2 '取余數
y = y\ 2 '取整
s = s & m
Loop While y <> 0
s = s & String(8 - Len(s), "0") '不足8位補零
Print StrReverse(s) '反轉字符串
End If
End Sub