Dynamic Array in Visual Basic .NET

Can you run the following code?

You will get the following error message
Index was outside the bounds of the array.

Why?
Size of the array is 4 but you are going to add the 5th item to the array

But you can run the following code

@ Line 10 , I have used
ReDim array(4)

You can make the array dynamic using ReDim command

Leave a Reply

Your email address will not be published. Required fields are marked *