What is the difference between Dim And Redim
Answer Posted / 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 |
Post New Answer View All Answers
How will we compare the texts in the two word files using QTP writing the script in Descriptive Programming. Thanks
Will there be any standards or requirements for page appearance and/or graphics throughout a site or parts of a site?
What is action? How many types of actions are there in qtp?
Hi, is it possible for recording shortcut key during record session? The application on which I am working is web based application. This application has several shortcut key associated with menu option. I have succesfully recorded all menu option but unable to record shortcut key.
What is the standard timing delay for web based application in qtp?
How QA specialist can identify when programmatic descriptions are useful?
Can an action have 2 shared object repositories associated with them? In that case, if two of them contain the same object, which one will be considered?
What is CMMP and CMMH?
how to test use the quality control .how to verify the image verification
What is the XML file architecture ?
What is the extension of the recovery scenario file in qtp?
I have developed and executed a script successfully, and saved the same to QC. When I tried to execute the script from QC, the script is not executing. What are the possible reasons?”
What is the purpose of loading qtp add-ins?
Can anyone pls tell me in realtime (descriptive programming) how will the properties of the object be given to the test team. R they given in an excel sheet and is the same sheet also given to the development team and by whom is this given? Thanks a lot.
I want to configure the OR and library files to a particular QTP test during run time. Note: OR and Library files are located in Quality Center. Is it possible in QTP? Anybody having code?