The goal of my program is to initialize a one-dimensional array through calling a sub-procedure in the main procedure. I get an error, though, on "TestScores" in my initializing for loop that the expression is not an array or method. I have it declared in the main function that TestScores is an array with an upper-bound of 10. What am I doing wrong?
'Author: Michael Barney
Option Explicit On
Option Strict On
Module Module1
Sub Main()
Dim Index As Integer
Dim TestScores(10) As Double
InitializeArray(TestScores)
PrintArray(TestScores)
LoadArray(TestScores)
PrintArray(TestScores)
SearchArray(TestScores)
End Sub
Sub InitializeArray(ByRef TestScores As Double)
Console.WriteLine("Entering: -----------------------> InitializeArray")
Dim Index As Integer
For Index = 0 To 10
TestScores(Index) = 0.0
Next Index
Console.WriteLine("Exiting: -----------------------> InitializeArray")
End Sub
Sub PrintArray(ByVal TestScores As Double)
Console.WriteLine("Entering: -----------------------> PrintArray")
'Your code goes here...
Console.WriteLine("Exiting: -----------------------> PrintArray")
End Sub
Sub LoadArray(ByVal TestScores As Double)
Console.WriteLine("Entering: -----------------------> LoadArray")
'Your code goes here...
Console.WriteLine("Exiting: -----------------------> LoadArray")
End Sub
Sub SearchArray(ByVal TestScores As Double)
Console.WriteLine("Entering: -----------------------> SearchArray")
'Your code goes here...
Console.WriteLine("Exiting: -----------------------> SearchArray")
End Sub
End Module