I'm trying to build a function that creates and returns a populated two-dimensional array based on function parameters. I'm receiving a "Can't assign to array" error with the following code. Any suggestions on how to make this work correctly? Thanks in Advance, Jon.
Dim Board() As Integer
Private Sub Form_Load()
Board() = LoadB(4, 4)
End Sub
Function LoadB(x As Integer, y As Integer) As Integer
Dim b() As Integer
Dim i As Integer, j As Integer, size As Integer
ReDim b(x, y) As Integer
size = 0
For j = 0 To x - 1
For i = 0 To y - 1
b(i, j) = size
size = size + 1
Next i
Next j
LoadB = b
End Function
Dim Board() As Integer
Private Sub Form_Load()
Board() = LoadB(4, 4)
End Sub
Function LoadB(x As Integer, y As Integer) As Integer
Dim b() As Integer
Dim i As Integer, j As Integer, size As Integer
ReDim b(x, y) As Integer
size = 0
For j = 0 To x - 1
For i = 0 To y - 1
b(i, j) = size
size = size + 1
Next i
Next j
LoadB = b
End Function