Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim n(3, 4) As Integer
Dim a(5) As Integer
Label1.Text = "近四期5星彩開獎號碼:"
For i = 0 To 3
Label1.Text = Label1.Text & vbCrLf & vbCrLf & "第" & i + 1 & "期:"
For j = 0 To 4
n(i, j) = InputBox("輸入第" & i + 1 & "期開獎號碼" & vbCrLf & "第" & j + 1 & "個號碼")
Select Case n(i, j)
Case 0 : a(0) += 1 : Label3.Text = "0出現" & a(0) & "次" : Label1.Text &= n(i, j) & Space(2)
Case 1 : a(1) += 1 : Label4.Text = "1出現" & a(1) & "次" : Label1.Text &= n(i, j) & Space(2)
Case 2 : a(2) += 1 : Label5.Text = "2出現" & a(2) & "次" : Label1.Text &= n(i, j) & Space(2)
Case 3 : a(3) += 1 : Label6.Text = "3出現" & a(3) & "次" : Label1.Text &= n(i, j) & Space(2)
Case 4 : a(4) += 1 : Label7.Text = "4出現" & a(4) & "次" : Label1.Text &= n(i, j) & Space(2)
Case 5 : a(5) += 1 : Label8.Text = "5出現" & a(5) & "次" : Label1.Text &= n(i, j) & Space(2)
'當程式碼偵測到數值符合我要的條件後,則繼續往後執行下一步驟
Case > 5 : MsgBox("請輸入0~5之間的數字", 16, "輸入錯誤") : n(i, j) = 0 : j = j - 1
'否則將其j值-1將其值清空後重新給予使用者輸入
End Select
Next
Next
End Sub
0 留言