作者catchtest (蕭雲)
看板Visual_Basic
標題Re: [.NET] For迴圈次數的問題
時間Fri Feb 12 17:10:48 2010
參考一下
Dim 我是陣列(9) as Integer
Dim index() as Integer = {1, 3, 4, 5, 8, 9}
....
....
For i as integer = 0 to index.GetUpperBound(0)
我是陣列(index(i))
....
....
Next
※ 引述《Laplace929 (大熊)》之銘言:
: 請問大大~
: 假設小弟有個迴圈
: Dim 我是陣列(9) as Integer
: .....
: ....
: For temp as integer = 0 to 9
: 我是陣列(temp)
: ....
: ......
: Next
: 假設 我的需求是
: 但是假如 我要抓陣列中的第 1 3 4 5 8 9
: 這樣的話 我 FOR 迴圈中的 temp 該怎樣設定呢??
: 感謝各位大大
--
噓 yushenglu:噓的有病08/09 12:06
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 112.104.120.136
→ MOONRAKER:不錯,可以改用foreach,不用寫難看的getupperbound() 02/12 23:02