logo
g Text Version
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies

dailyclick
Bored? Games!
Nutrition
Postcards
Take a Quiz
Rate My Photo

new
Emerging Music
Home Improvement
Comedy Movies
Vision Issues
Jewelry Collecting
Feng Shui
Appalachia


dailyclick
All times in EST

Full Schedule
g
g ASP Site
Editor Wanted
BellaOnline's ASP Editor

g

Redim and Preserve in ASP Arrays

Guest Author - Lisa Shea

When you're using ASP arrays, sometimes you want to make them larger part way through processing. The Redim command lets you alter an array size - and the preserve command saves the data already there.

Let's say you start out with an array that normally only needs around 5 items in it. So you could do

Dim ShopCart(5)

This would conserve memory space and take into account what most people would use it for. But let's say someone comes along who wants more than 5 items in their shopping cart! You don't want to lose that extra information. So to make the array size larger, you would say

Redim ShopCart(10)

or whatever new size you wanted to bump it up to. One problem, though. A redim command loses any data currently in the array. This might be fine if you're just getting started, but if someone is halfway through shopping it'd be bad to lose their data. In that case, you would instead use -

Redim PRESERVE ShopCart(10)

This keeps the array we had already and just adds more space to it.

ASP Array Function List

Introduction to ASP Ebook

Download this ebook to get everything you need to know about learning ASP - from a step by step tutorial to function lists, sample code, common errors and solutions, and much more! 101 pages.

This site needs an editor - click to learn more!

RSS | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


Add Redim+and+Preserve+in+ASP+Arrays to Twitter Add Redim+and+Preserve+in+ASP+Arrays to Facebook Add Redim+and+Preserve+in+ASP+Arrays to MySpace Add Redim+and+Preserve+in+ASP+Arrays to Del.icio.us Digg Redim+and+Preserve+in+ASP+Arrays Add Redim+and+Preserve+in+ASP+Arrays to Yahoo My Web Add Redim+and+Preserve+in+ASP+Arrays to Google Bookmarks Add Redim+and+Preserve+in+ASP+Arrays to Stumbleupon Add Redim+and+Preserve+in+ASP+Arrays to Reddit



For FREE email updates, subscribe to the ASP Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor


Content copyright © 2012 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.

g


g features
Best uses for RSS

RSS and its future.

Force Download Dialog box with ASP

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Fav Social Network
Facebook
Twitter
Google+
other / none



BellaOnline on Facebook
g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2012 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor