Student Mode Code Display

Welcome to the Fraternity!

Commenting has been enabled. You can comment on all the Code Items now.

Static and Dynamic Array Preserve Keyword


Add This Code to My Favourite List
Enter Email

Contributed By admin
Date 2015-01-27 04:40:23

'######################################################
'Static and Dynamic Array, Use of Preserve Keyword
'#######################################################

'ReDim is used to Redimensioning the existing 
'"Dynamic Array".
'Case 1: ReSizing Static Array is not Possible
Dim Arr(1)
Arr(0)= "My"
Arr(1) = "Name"

ReDim Arr(2) 'Will give Error
'Above Statement Will give error as Arr is not aDynamic 
'array since its size has already been decided during its 
'declaration

'Case 2: ReSizing Dynamic Array
Dim Arr()’ Dynamic Array
ReDim Arr(1)
Arr(0)= "My"
Arr(1)= "Name"

'Again Resizing
ReDim Arr(2)

'This time array will resize but it will not 
'retain the previous information
'So Preserve Keyword is to be used

'Case 3: ReSizing Dynamic Array using Preserve Keyword
Dim Arr() 'Dynamic Array
ReDim Arr(1)
Arr(0)= "My"
Arr(1) = "Name"

'Again Resizing
ReDim Preserve Arr(2)
Arr(2)="Akash"

'Preserve keyword will retain previous information

Download Above Code

Comments:


Updated by AKT at 2015-04-15 10:52:51
na
Updated by MaxPowerpeest at 2018-12-29 06:05:01
Download missing dll from <a href=http://founddll.com/isdone-dll/>Error isdone.dll</a> page. Fix your error now!
Updated by EJhar at 2018-12-31 09:54:10
Sir Elton John is my favourite singer of all time. I’m happy to present for you this setlist 2019. Check <a href=http://eltonjohntour2019.com>Elton John concert Anaheim</a> this link to get your best ticket for the farewell Elton John tour.
Updated by EJsnams at 2019-01-06 07:12:49
Sir Elton John is my favourite UK singer of all time. I’m very glad to present for you this tour list. Check http://eltonjohntour2019.com - Elton John tour Tulsa this website to get your ticket for the farewell Elton John tour.
Updated by Carrienams at 2019-05-07 16:57:46
Carrie Underwood is my favourite US contry singer. She is young, beautiful and charming woman in her 30s. Her strong voice takes me away from all problems of this world so I can enjoy my life and listen songs created by her mind. Now the singer is on a Cry Pretty 360 Tour started in May of 2019. The concerts scheduled for this year, up to the 31st of October. Tickets are available for all men and women with different income. If you love country music as mush as I, then you must visit at least one of her concert. All tour dates are available at the <a href=https://carrieunderwoodconcerts.com>Carrie Underwood concerts 2019</a>. Open the website and make yourself familiar with all powerful Carrie Underwood concerts in 2019!

Add your comments...
Name : *      
Email : *      
The content of this field will be kept private and will not be shown publicly

Your Comment/Answer *

Enter the text present in this box : *