Can Redim be used to declare a new array ?

Answer Posted / ashok s bhosale

Redim can be Used Create New array of different length
eg
Dim arr() As Integer
ReDim arr(3)
arr(0) = 1
arr(1) = 2
arr(2) = 3

MsgBox arr(0) & ":" & arr(1) & ":" & arr(2)
'It Print 1,2,3

ReDim arr(4)

MsgBox arr(0) & ":" & arr(1) & ":" & arr(2) & ":" & arr(3)

it display 0,0,0,0
it reinitilize all element to 0 it means it create new Array

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is it possible to change menu runtime using API? If yes Specify the function names?

1466


Can you tell me the properties of the controls?

1576


What is DDE?

1778


How to get Cursor position using API?

1682


How do I access C style strings?

1000






i want to retrive data from one spead sheet to another UI (workbook). control will search cell by cell for each row and load the data in another workbook(UI).

1777


What is the use of Data Form Wizard?

1498


Explain about control properties?

612


Write the Steps in Creating an ActiveX Control?

1974


what are the types of LockEdits in DAO?

1513


What is the use of Immediate, Local Window?

1501


Why do I get "object not an array" when I try reference the fields of a global object variable which I have set to a table?

1155


Whether HTML supports multimedia: and document links?

1438


What is script control?

575


Timer control contains ________ no. of events.

1743