Visual Basic code 一問

http://hk.geocities.com/cs9778/vbcode.doc

個code係以上既網址到

如何可以將49個數1次過唔重複禁顯示哂出黎

更新:

但係我一禁之後佢load唔到.."

係咪因為太多??

1 個解答

評分
  • ?
    Lv 4
    1 十年 前
    最佳解答

    基本上加多個counter check 下果個數有冇比人用到就ok

    Dim Count As Integer

    Dim Msg As String

    Dim array(49) As Integer

    Dim check(49) As Integer

    Dim x As Integer

    lstNumber.Items.Clear()

    Randomize()

    For Count = 1 To 49

    array(Count) = Count

    check(Count) = 1

    Next Count

    For Count = 1 To 6

    x = CInt(Rnd() * (48 - Count + 1)) + 1

    do while check(x) < 1

    x = CInt(Rnd() * (48 - Count + 1)) + 1

    Loop

    Check(x) = 0

    Msg = "Number " & Count & " is " & array(x)

    lstNumber.Items.Add(Msg)

    array(x) = array(48 - Count + 1) + 1

    Next Count

    資料來源: 自己~
還有問題嗎?立即提問即可得到解答。