I'm trying to populate an Array using a Function and passing the populated Array back to Main() for more processing. The function doesn't return any values. The Array FutureArray cells are blank. Using VB
MADE THE RECOMMENDED CHANGES. Now I'm Getting errors BC30672 Explicit initialization is not permitted for arrays declared with explicit bounds BC3108 Array modifiers cannot be specified on both a variable and its type
UPDATE; I've resolved the two errors and posted the new code. Still not getting any values returned for FutureArray
Module Module1
Sub Main()
Dim FutureArray(,) As Object = PopulateFutureArray()
Dim ArrayRows As Integer
Dim ArrayColumns As Integer
ArrayRows = 2
ArrayColumns = 1
For i As Integer = 0 To ArrayRows
For j As Integer = 0 To ArrayColumns
Console.WriteLine(FutureArray(ArrayRows, ArrayColumns))
Next
Next
End Sub
Function PopulateFutureArray() As Object(,)
'Start of Create Future Dataes Array
Dim FutureArray(2, 1)
FutureArray(0, 0) = 10
Console.WriteLine(FutureArray(0, 0))
FutureArray(0, 1) = 0
Console.WriteLine(FutureArray(0, 1))
FutureArray(1, 0) = 11
Console.WriteLine(FutureArray(1, 0))
FutureArray(1, 1) = #11/1/2020#
Console.WriteLine(FutureArray(1, 1))
FutureArray(2, 0) = 1
Console.WriteLine(FutureArray(2, 0))
FutureArray(2, 1) = 0
Console.WriteLine(FutureArray(2, 1))
Return FutureArray
'End PopulateFutureArray
End Function
End Module
The function doesn't return any values- it does. You are just throwing them away.Console.WriteLine(FutureArray(ArrayRows, ArrayColumns))to use theiandjvariables, see answers below.