BrainDump
  Home arrow BrainDump arrow Page 2 - VBScript: Multidimensional Arrays, Stateme...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
BRAINDUMP

VBScript: Multidimensional Arrays, Statements, and Commenting
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 4
    2007-12-10

    Table of Contents:
  • VBScript: Multidimensional Arrays, Statements, and Commenting
  • Dynamic Arrays
  • Conditional Statements
  • If...Then...Elseif
  • The Select Case
  • Commenting Your Code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    VBScript: Multidimensional Arrays, Statements, and Commenting - Dynamic Arrays


    (Page 2 of 6 )

    Dynamic arrays are arrays whose size can be altered. To do so, you first initialize the array with no elements, then use ReDim to change its size, like so:


    <html>

    <body>

    <script type="text/vbscript">

    Dim cow()

    Redim cow(2)

    cow(0)="Moo"

    cow(1)="Moo Moo"

    cow(2)="Moo Moo Moo"

    Redim Preserve cow(3)

    cow(3)="Moo Moo Moo Moo"

    </script>

    </body>

    </html>

    The above code initially creates a dynamic array named cow, with no elements. We then use ReDim to change the number of elements within cow to 3 (cow(2)). Then we add some values to the array. Finally, we decide to add even more elements to cow, and ReDim it again to hold 4 values. We add the fourth value to the array, making sure to use the Preserve keyword. Had we not used Preserve, then all of the data in our array would have been deleted when we Redimmed it.

    More BrainDump Articles
    More By James Payne


       · Thanks once more for dropping by to read my article. Here we discuss Arrays,...
     

    BRAINDUMP ARTICLES

    - Internet Explorer 8 Review
    - Nilpo`s Top Windows Add-Ons
    - Beginning Silverlight 2.0 Development using ...
    - Fixing Vista`s Troubles
    - Preparing Windows Images for Mass Deployment
    - The Trouble With Vista
    - Slipstreamed and Unattended Windows Installa...
    - Microsoft Office SharePoint Server
    - Microsoft Office SharePoint Designer
    - Microsoft Windows SharePoint Services 3.0
    - Microsoft Live Mesh Overview
    - XAML Brushes and Silverlight
    - Silverlight and XAML Basics
    - Immortal XP
    - XAML Basics





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT