What is the difference between Dim And Redim

Answers were Sorted based on User's Feedback



What is the difference between Dim And Redim..

Answer / ravi_kanakam

Dim statement is used to formally declare a variable, where
as ReDim statement is used to resize a dynamic array that
has already been formally declared.

Is This Answer Correct ?    97 Yes 9 No

What is the difference between Dim And Redim..

Answer / paayal

Dim is a data type(variant) that user can assign to a
variable like Dim User
User = "QTP"

Redim can be use to reinitialize the variable. We can give
a new value to the same variable and can use it again in
the script.

Is This Answer Correct ?    59 Yes 16 No

What is the difference between Dim And Redim..

Answer / deepa

Dim Statement

Declares variables and allocates storage space.

Dim varname[([subscripts])][, varname[([subscripts])]] . . .

Variables declared with Dim at the script level are
available to all procedures within the script. At the
procedure level, variables are available only within the
procedure.

You can also use the Dim statement with empty parentheses
to declare a dynamic array. After declaring a dynamic
array, use the ReDim statement within a procedure to define
the number of dimensions and elements in the array. If you
try to redeclare a dimension for an array variable whose
size was explicitly specified in a Dim statement, an error
occurs.


ReDim Statement
Declares dynamic-array variables, and allocates or
reallocates storage space at procedure level.

ReDim [Preserve] varname(subscripts) [, varname
(subscripts)] . . .

The ReDim statement is used to size or resize a dynamic
array that has already been formally declared using a
Private, Public, or Dim statement with empty parentheses
(without dimension subscripts). You can use the ReDim
statement repeatedly to change the number of elements and
dimensions in an array.

If you use the Preserve keyword, you can resize only the
last array dimension, and you can't change the number of
dimensions at all. For example, if your array has only one
dimension, you can resize that dimension because it is the
last and only dimension. However, if your array has two or
more dimensions, you can change the size of only the last
dimension and still preserve the contents of the array.

The following example shows how you can increase the size
of the last dimension of a dynamic array without erasing
any existing data contained in the array.

ReDim X(10, 10, 10)
. . .
ReDim Preserve X(10, 10, 15)
Caution If you make an array smaller than it was
originally, data in the eliminated elements is lost.

Is This Answer Correct ?    20 Yes 7 No

What is the difference between Dim And Redim..

Answer / sabitha reddy

Dim statement is used to declare a variable

The redim statement is used to change the array size within the script,

for example..
if we have declared an array dim customer (30)
but after that we want to change the size of the array , we can do it with the help of Redim statement
like-Redim customer(100)

Is This Answer Correct ?    14 Yes 5 No

Post New Answer

More QTP Interview Questions

Inserting a Call to Action is not importing all columns in Datatable of globalsheet. Why?

1 Answers   Crea,


Hi I have exp in manual testing and planning to move in automation testing qtp(9.2).So can help me how to automate customer relationship management tool using qtp and vb script this tool already developed so how can I test it whatever maintaining by development team like documents,various options just give the whole life cycle thanks in advance

0 Answers   Mphasis,


What is an expert view and keyword view?

0 Answers  


Presently i am working on QTP 8.2 Version,i want to know features in 9.2 version, because i have not sufficient time to put the effort on the 9.2 version

0 Answers  


In application which areas to be automated and what kind of situation will be take? using QTP? Plz give me the clear answer

0 Answers   Tavant Technologies,






in QTP, we have options like (record and play,recording modes(normal,analog,low level),object identification,smart identification,object repository,synchronizing test,transactions,checkpoints(std,bitmap,text,text area,DB,XML,accessibility),regular expression,actions,data driving,parameter,parameterization,data tables,recovery scenario(pop up,object state,test run error,application crash). real time users of QTP, pls say and when and at what point u have used all these options ,in ur concerned project.pls give me explanation in accordance with ur real time project handled. real users pls send some time in the aboue case. if u can send the the reply through allinterview or at ref_it_ref@yahoo.co.in

1 Answers  


What is the difference between functional spec. and Business requirement specification?

5 Answers  


I have 1 to 10 action are there, i want action1 output becomes to action 10 input? pls any can give script for this scenario?

5 Answers   AZTEC,


how to choose the framework in qtp ? 2)when we go for the descriptive programming ?

2 Answers   Syntel,


where exactly we can't do the automation testing. give some examples

2 Answers   Virtusa, Wipro,


WHAT IS PARAMITARIZATION?

8 Answers  


Explain types of descriptive programming?

0 Answers  


Categories