Mega Code Archive

 
Categories / VB.Net Tutorial / Collections
 

Use array UBound in For loop

Module Module1     Sub Main()         Dim Scores(2) As Integer         Scores(0) = 45         Scores(1) = 55         Scores(2) = 65         For intLoopIndex As Integer = 0 To UBound(Scores)             Console.WriteLine("Score(" & intLoopIndex & ") = " & Scores(intLoopIndex))         Next intLoopIndex     End Sub End Module Score(0) = 45 Score(1) = 55 Score(2) = 65