Set the number of elements in an array from input receivied via console.
Posted on 2006-07-20
I need to Dimension an array of integers and set the number of elements in the array based on the response recieved from the console. Can someone provide an example. I have tried the example below, but Lenth is read only.
Dim arValues() As Integer ' Array to store values
Dim intElements As Integer ' The number elements or values to be entered
Console.Write("Number of elements in the array (less than 100) : ")
intElements = Console.ReadLine()
' arValues.Length = Int32.Parse(intElements)
I am looking for some guidance or sample code that will help me complete this. Any information will be greatly appreciated. Thanks. DC900
Visual Studio 2005 & VB.NET