Saturday, July 28, 2012

Difference between Dim and Redim

*********************************************************************************
Dim :
************************************************************************  ***
Dim is used to  declare the variables
*********************************************************************************
Redim : 
*********************************************************************************
 Redim Is used to re size the array variables
*********************************************************************************
Preserve :
*********************************************************************************
Preserve is the word we can preserve the last array values
*********************************************************************************


Example:

Dim a()

ReDim a(3)

a(0) = "1"

a(1) = "2"

a(2)= "3"


Redim preserve a(5)

a(3) = "14"

a(4) = "15"

*********************************************************************************
Note: if we are using redim statement with out preserve key, it will not preserve the previous array value & will creates fresh array
*********************************************************************************

No comments:

Post a Comment