DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Erase method for VBS not working

Solved!
Go to solution

Hi,

 

I have a fixed array, which is dimensioned at the top of the code as usual, and then partially used later on. After this, I wish to empty the array so that it can be used in a following piece of code. The method Erase for VBS would seem to be appropriate and the help files give an example which seems to fit my needs. However, when the code reaches the Erase call it fails with the error message "Type mismatch: Erase".

 

Thinking this might be something to do with it only being partially filled, I then copied the sample code from the help files and that doesn't work either!

 

My code is essentially as follows:

Dim AvgVal(1)

AvgVal(0) = 5

Erase(AvgVal)

And the help file code is:

Dim NumericArray(11)
Dim DynamicArray()
ReDim DynamicArray(7)
Erase(NumericArray)
Erase(DynamicArray)

 

Why isn't either piece of code working?

 

Thanks,

 

Simon.

0 Kudos
Message 1 of 2
(1,142 Views)
Solution
Accepted by topic author Simon_Aldworth

Hi Simon,

 

it seems that the error message is somehow missleading. The cause of the error message is the use of brackets. Try
Erase AvgVal

or

call Erase(AvgVal)

instead. This should work.

 

Regards,
Rainer

0 Kudos
Message 2 of 2
(1,121 Views)