Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
'宣告 generator 屬於 Random類別
Dim generator As New Random '宣告 randomValue是一個整數變數
Dim randomValue As Integer
'宣告 generator 屬於 Random類別
Dim generator As New Random '宣告 randomValue是一個整數變數
Dim randomValue As Integer
'將下一個產生介於 10~100之間的數, 指定給reandomValue變數
randomValue = generator.Next(10, 100)
randomValue = generator.Next(10, 100)
'將亂數的值當成按鈕文字來顯示
Button1.Text = randomValue
End Sub
Button1.Text = randomValue
End Sub
沒有留言:
張貼留言