BrainDump
  Home arrow BrainDump arrow Page 3 - VBScript: Plain and Simple
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: Plain and Simple
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 6
    2007-12-03

    Table of Contents:
  • VBScript: Plain and Simple
  • Writing Our First VBScript
  • Variables...In....Space!
  • Arrays

  • 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: Plain and Simple - Variables...In....Space!


    (Page 3 of 4 )

    Variables are containers that you store data in. 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 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.

    Before you can use any variables, you must declare them. You do so 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 named firstVariable and 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 BrainDump Articles
    More By James Payne


       · Hey, James. That's a nice intro piece. Being a VBS author myself, I understand how...
       · Here we are yet again. Thanks for stopping by and reading yet another masterpiece by...
     

    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 1 hosted by Hostway
    Stay green...Green IT