需要一个button按钮,一个Label标签
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim Lucky As String() = {"张三", "李四", "王五", "赵六", "神八"}
Dim r As Double = random_number(4, 0)
Label1.Text = Lucky(r)
End Sub
Private Function random_number(max As Integer, min As Integer) As Integer '定义一个取随机数的函数
Randomize()
random_number = (max - min) * Rnd() + min
Return random_number
End Function
End Class