Emptying an array

Results 1 to 3 of 3

Thread: Emptying an array

  1. #1
    vrushali sarfare Guest

    Default Emptying an array

    How do I empty an array?i.e how do i remove the elements from the array and simultaneously adjust the count accordingly.<BR><BR>Ex: Dim myarray(2)<BR>myarray(0)="hello"<BR>myarray(1)="wo rld"<BR>&#039;Some code-----------<BR>&#039;Later<BR>myarray(0)=""<BR>&#039;Still Ubound(myarray) will be 2 and not 1.How do i make the count also 1?<BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Emptying an array

    Try this<BR><BR>Redim myarray(x)<BR><BR>This Clears the array and later on you can<BR>change the no.of elements.

  3. #3
    Join Date
    Dec 1969

    Default See the VBScript documentation...

    ...of the ReDim (and ReDim Preserve) statement.<BR><BR>Note that you can NOT remove elements this way *except* from the "top down". That is, if the array has 7 elements, you can lop off the 7th or the 7th and 6th or the 7th, 6th, and 5th, etc. But you can&#039;t lop off element 0, for example.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts