Well I am totally beginner.
I came across this program.

Module arrayredim
    Sub main()
        Dim marks() As Integer
        ReDim marks(2)
        marks(0) = 85
        marks(1) = 75
        marks(2) = 90
        ReDim Preserve marks(10)
        marks(3) = 80
        marks(4) = 76
        marks(5) = 92
        marks(6) = 99
        marks(7) = 79
        marks(8) = 75
        For i = 0 To 10
            Console.WriteLine(i & vbTab & marks(i))
        Next i
        Console.ReadKey()



    End Sub
End Module

In this program can somebody explain me why
ReDim Preserve marks(10) is important to be written here?

Also
ReDim marks(2) is important to be written in this way?

I tried cancelling these lines and run the program but it showed errors.

ReDim Preserve marks(10) is important to be written here?

Preserve retains existing values in the array, so if you want to keep the values of indexes 0 through 2, it's important.

ReDim marks(2) is important to be written in this way?

Um...yes?

Dim marks() As Integer ' declares an one dimensional array to hold integer
ReDim marks(2) ' inialises the array to hold 3 integers at indecies (0) (1) ans (2)
If one needs to hold more integers and doesn want to loose the ones that have been entered already then one uses
ReDim Preserve marks(10)' which now can hold 11 intgers 0 to 10 and preservesthe ones already enterd
http://www.tutorialspoint.com/vb.net/vb.net_arrays.htm

This article has been dead for over six months. Start a new discussion instead.