利用Inputbox輸入一個合法的3位正整數,然後求該數逆序並利用print方法在窗體
你這都夠一個vb程式實驗了
程式碼如下
(1)if keycode=13 then
if isnumeric(text1.text)=true then
if val(text1.text)<100 or val(text1.text)>999 then
msgbox "你輸入的整數不合法 100-999"
exit sub
else
msgbox "輸入合法"
end if
(2)
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer
Dim i As Integer, j As String
i = 100 + Int(Rnd * 900)
a = Int(i / 100)
b = i Mod 100
c = b Mod 10
b = Int(b / 10)
j = c & b & a
MsgBox i & "," & j
End Sub
利用Inputbox輸入一個合法的3位正整數,然後求該數逆序並利用print方法在窗體
你這都夠一個vb程式實驗了
程式碼如下
(1)if keycode=13 then
if isnumeric(text1.text)=true then
if val(text1.text)<100 or val(text1.text)>999 then
msgbox "你輸入的整數不合法 100-999"
exit sub
else
msgbox "輸入合法"
end if
end if
(2)
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer
Dim i As Integer, j As String
i = 100 + Int(Rnd * 900)
a = Int(i / 100)
b = i Mod 100
c = b Mod 10
b = Int(b / 10)
j = c & b & a
MsgBox i & "," & j
End Sub