Windows Scripting
  Home arrow Windows Scripting arrow VBScript: Array Functions
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  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
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? 
WINDOWS SCRIPTING

VBScript: Array Functions
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 8
    2008-05-05

    Table of Contents:
  • VBScript: Array Functions
  • Arrays
  • Multi-Dimensional Arrays
  • Array Functions
  • UBound and LBound
  • The Join Function

  • 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: Array Functions


    (Page 1 of 6 )

    In our last VBScript tutorial we covered the string functions that VBScript has to offer. While there aren’t quite as many Array functions as there were with the earlier date functions, never fear: I still haven’t covered the formatting, string, conversion, and other functions. So get ready, because (as usual) we still have plenty of ground to cover.

    An Array of Arrays

    If you have made it his far in the series then you no doubt know all about variables and arrays. But just in case, I will briefly cover them here. Feel free to skip to the section labeled VBScript Array Functions if you are familiar with variables and arrays and do not need a refresher. Or if you enjoy the pain, read on!

    Variables

    Variables are containers in which you store data. In that sense, they're similar to a box. You can put data in them, you can take data out and put it back in, you can take data out and put new data in, or you can delete the data within them. They are called variables because the data within them varies.

    You declare variables in VBScript with the Dim statement. Here, we will declare some variables and give them a value:

    <html>

    <body>

    <script type="text/vbscript">

    Dim firstVariable

    Dim secondVariable

    firstVariable="13"

    secondVariable="James"

    </script>

    </body>

    </html>

    The above code creates two variables, one namedfirstVariableand the other named secondVariable. We then store data in each one (13 and James respectively). Now let's do something with those variables:


    <html>

    <body>

    <script type="text/vbscript">

    Dim firstVariable

    Dim secondVariable

    firstVariable = 13

    secondVariable = "James"

    document.write("My IQ is " & firstVariable)

    document.write("<br />My name is " & secondVariable)

    </script>

    </body>

    </html>

    The above code would print the following to the browser:

      My IQ is 13

      My name is James

    You can also declare variables and use them in this manner:


    <html>

    <body>

    <script type="text/vbscript">

    Dim firstVariable, secondVariable

    firstVariable = 13

    secondVariable = "James"

    document.write("My IQ is " & firstVariable)

    document.write("<br />My name is " & secondVariable)

    </script>

    </body>

    </html>

    You get the same result, but save space by declaring the variables on the same line.

    More Windows Scripting Articles
    More By James Payne


       · Thanks for stopping by to read my article. In this episode we discuss Array and...
       · I get that the Split function splits strings and arrays, but you're not very clear...
     

    WINDOWS SCRIPTING ARTICLES

    - More Windows Scripting Workarounds from Nilpo
    - Overloading Methods and More in VBScript
    - Improving MFC for Windows Vista
    - Regular Expressions in VBScript
    - Working with Dates in WMI
    - Completing Calendars with VBScript Date Func...
    - Building Calendars with VBScript Date Functi...
    - Working With Dates and Times in VBScript
    - Designing WCF DataContract Classes Using the...
    - Understanding Dates and Times in VBScript
    - Working With Arrays in VBScript
    - Compressed Folders in WSH
    - Using .NET Interops in VBScript
    - Nilpo`s Scripting Secrets, Vol I
    - Database operations using Silverlight 2.0 WC...





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