I'm guessing that you have those lines outside of any method definition. You can declare and initialise an array outside a method, which is what your first line does, but to set individual elements you must do it inside a method. You can do this:
VB Code:
Dim myArray(upperBound) As Object
Private Sub SomeMethod()
myArray(0) = someObject
myArray(1) = someOtherObject
'...
End Sub
or this:
VB Code:
Dim myArray() As Object = {someObject, someOtherObject, ...}
Note in the second example I have not specified an upper bound. When you initialise an array at the time it's declared you cannot specify an upper bound as it is controlled by the size of the array you use to initialise it with.