Mega Code Archive

 
Categories / VB.Net / Data Structure
 

Array Upper Bound and Lower Bound

Imports System Public Class MainClass     Shared Sub Main(ByVal args As String())         Dim friends() As String = {"1", "2", "3","4", "5"}         Console.WriteLine("Upper bound: " & UBound(friends), "Array Demo")         Console.WriteLine("Lower bound: " & LBound(friends), "Array Demo")         Array.Sort(friends)         Dim upperBound As Integer = friends.Length         Dim random As New System.Random()         Dim n As Integer         For n = 1 To 10             Dim index As Integer = random.Next(upperBound)             Console.WriteLine(index & ": " & friends(index))         Next     End Sub      End Class