w3schools    w3Schools
Search W3Schools :
   
HOME HTML CSS XML JAVASCRIPT ASP PHP SQL MORE...   References Examples Forum About
ADVERTISEMENTS

XML Certification
Download XML editor
Custom Programming
 
Table of contents
ASP Tutorial
ASP HOME
ASP Introduction
ASP Install
ASP Syntax
ASP Variables
ASP Procedures
ASP Forms
ASP Cookies
ASP Session
ASP Application
ASP #include
ASP Global.asa
ASP Send e-mail

ASP Objects
ASP Response
ASP Request
ASP Application
ASP Session
ASP Server
ASP Error

ASP FileSystem
ASP TextStream
ASP Drive
ASP File
ASP Folder
ASP Dictionary
ASP ADO

ASP Components
ASP AdRotator
ASP BrowserCap
ASP Content Linking
ASP Content Rotator

ASP Quick Ref
ASP Summary

Examples/Quiz
ASP Examples
ASP Quiz
ASP Exam

Selected Reading
Web Statistics
Web Glossary
Web Hosting
Web Quality

W3Schools Tutorials
W3Schools Forum

Helping W3Schools

 

ASP Dictionary Object

previous next

The Dictionary object is used to store information in name/value pairs (referred to as key and item)


Examples

Does a specified key exist?
This example demonstrates how to first create a Dictionary object, and then use the Exists method to check if a specified key exists.

Return an array of all items
This example demonstrates how to use the Items method to return an array of all the items.

Return an array of all keys
This example demonstrates how to use the Keys method to return an array of all the keys.

Return the value of an item
This example demonstrates how to use the Item property to return the value of an item.

Set a key
This example demonstrates how to use the Key property to set a key in a Dictionary object.

Return the number of key/item pairs
This example demonstrates how to use the Count property to return the number of key/item pairs.


The Dictionary Object

The Dictionary object is used to store information in name/value pairs (referred to as key and item). The Dictionary object might seem similar to Arrays, however, the Dictionary object is a more desirable solution to manipulate related data.

Comparing Dictionaries and Arrays:

  • Keys are used to identify the items in a Dictionary object
  • You do not have to call ReDim to change the size of the Dictionary object
  • When deleting an item from a Dictionary, the remaining items will automatically shift up
  • Dictionaries cannot be multidimensional, Arrays can
  • Dictionaries have more built-in functions than Arrays
  • Dictionaries work better than arrays on accessing random elements frequently
  • Dictionaries work better than arrays on locating items by their content

The following example creates a Dictionary object, adds some key/item pairs to it, and retrieves the item value for the key gr:

<%
Dim d
Set d=Server.CreateObject("Scripting.Dictionary")
d.Add "re","Red"
d.Add "gr","Green"
d.Add "bl","Blue"
d.Add "pi","Pink"
Response.Write("The value of key gr is: " & d.Item("gr"))
%>

Output:

The value of key gr is: Green 

The Dictionary object's properties and methods are described below:

Properties

Property Description
CompareMode Sets or returns the comparison mode for comparing keys in a Dictionary object
Count Returns the number of key/item pairs in a Dictionary object
Item Sets or returns the value of an item in a Dictionary object
Key Sets a new key value for an existing key value in a Dictionary object

Methods

Method Description
Add Adds a new key/item pair to a Dictionary object
Exists Returns a Boolean value that indicates whether a specified key exists in the Dictionary object
Items Returns an array of all the items in a Dictionary object
Keys Returns an array of all the keys in a Dictionary object
Remove Removes one specified key/item pair from the Dictionary object
RemoveAll Removes all the key/item pairs in the Dictionary object


previous next


The tools you need to build your web project!

Instant Demo

Ektron CMS400.NET Version 7.6 delivers all of the flexibility and features you need to deploy the Web site you want, quickly and efficiently.

learn more...

 

 

 

6 ways to take your site to the next level with Ektron:

Social Networking Create site stickiness through social networking. Keep it personal, relevant and interactive and they'll come back for more.
Open API Keep it open. Your site needs to be ready and able to connect to outside services. Ektron's open API gives you maximum flexibility.
Document Management Streamline content and document management. Users need to quickly and intuitively find and add information.
Content Authors Empower your content authors. Reduce IT bottlenecks by allowing business users to create and edit Web content and forms.
Taxonomy Climb to the top of search rankings. SEO tools, URL aliasing and eCommerce for your digital marketing strategy
Web 2.0 Tools Add powerful Web 2.0 tools like blogs, wikis, forums, geo-mapping, rating systems and RSS feeds easily.
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today.

 
WEB HOSTING
dotnetbutton
Dynamic button image generation
$15 Domain Name
Registration
Save $20 / year!
Buy UK Domain Names
Register Domain Names
Cheap Domain Names
Cheap Web Hosting
Best Web Hosting
PHP MySQL Hosting
Top 10 Web Hosting
UK Reseller Hosting
Web Hosting
FREE Web Hosting
WEB BUILDING
Website Templates
Flash Templates
Website Builder
Internet Business Opportunity
Custom Programming
FREE Trial or Demo
Web Content Manager
Forms,Web Alerts,RSS
Download XML editor
FREE Flash Website
FREE Web Templates
EDUCATION
US Web Design Schools
HTML Certification
JavaScript Certification
XML Certification
PHP Certification
ASP Certification

Home HOME or Top of Page Validate   Validate   W3C-WAI level A conformance icon Printer Friendly  Printer Friendly

W3Schools is for training only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user.
While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright 1999-2009 by Refsnes Data. All Rights Reserved.