看板 Visual_Basic 關於我們 聯絡資訊
※ 引述《Bonder (Yes)》之銘言: : 各位大大...小弟初學VB.net : 想要產生6個亂數在1-49之間 : 很直觀就這樣寫 Dim i As Int16, j As Int16, Exists As Boolean Dim r(5) As Integer Randomize() For i = 0 To 5 Do r(i) = Int(Rnd() * (49 - 1) + 1) '最大值減最小值加一才對@@ Exists = False '檢查是否重複 For j = 0 To i - 1 If r(i) = r(j) Then Exists = True : Exit For Next If Not Exists Then Exit Do Loop Next For i = 0 To 5 Controls("Label" & (i + 1)).Text = r(i) Next -- ▃▅▇▆▄ ▆▂▃ ` 逝去感如何能留住,半點遺留殊不易,██▅▇▄▃ ▇▃▂" . █████████▃i ▁▄▇ 更多悽悽慘慘的遭遇………██▆▃ █▅▆▃ˍ▄* ▂█▄▇▅▂. 我不知道,王~八~蛋~~! ▂▆███ █▄▃ 。fumizuki。Check。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 60.248.175.60
biox:還是會出現:從字串 "Label1" 轉換為型別 'Integer' 是無效的 01/07 16:06
biox:錯誤發生在controls那邊 這是什麼問題? 01/07 16:07