Dictionary object in vbscript, Visual Basic Programming

Assignment Help:

The Dictionary object stores data as key, item pairs. A Dictionary object is the corresponding of a PERL associative array. Items, that can be any form of data, are stored in the array. Each item is related with a unique key. The key is utilized to retrieve an individual item & is an integer or a string usually, however can be anything except an array.

The following code shows how to create & use a Dictionary object:

Dim d  'Create a Script Level variable

Set d = CreateObject("Scripting.Dictionary")

Sub cmdAdd_OnClick

d.Add "0", "Amar"     'Add some keys and items d.Add "1", "Bunty"

d.Add "2", "Chaman"

a = d.items

For i = 0 To d.Count document.frmForm.Elements(i).Value = a(i)

Next

End Sub

Sub cmdExist_onClick

d.Add "a", "Amar"     'Add some  keys and items. d.Add "b", "Bunty"

d.Add "c", "Chaman" If d.Exists("c") Then

msgbox "C key exists."

Else

msgbox "C key does not exist." End If

End Sub

Sub cmdKey_onClick

d.Add "a", "Amar"     'Add some keys and items. d.Add "b", "Bunty"

d.Add "c", "Chaman"

d.Key("c") = "d"        'Set key for "c" to "d". End Function

End Sub

Sub cmdKeys_onClick

d.Add "a", "Amar"     'Add some  keys and items. d.Add "b", "Bunty"

d.Add "c", "Chaman" a = d.keys

For i = 0 To d.Count document.frmForm.Elements(i).Value = a(i)

Next

End Sub

Sub cmdRemove_onClick

d.Add "a", "Amar"     'Add some  keys and items. d.Add "b", "Bunty"

d.Add "c", "Chaman"

d.Remove("b")

a = d.keys

For i = 0 To d.Count document.frmForm.Elements(i).Value = a(i)

Next

End Sub

Sub cmdCompareMode_onClick d.CompareMode = vbTextCompare

d.Add "a", "Amar"      'Add some keys and items. d.Add "b", "Bunty"

d.Add "c", "Chaman"

d.Add "B", "Baltimore"   'Add method fails on this line because the

'letter b exists already in the Dictionary.

End Sub


Related Discussions:- Dictionary object in vbscript

Account Balance, The user has to enter a starting balance, the dollar amoun...

The user has to enter a starting balance, the dollar amount of deposits, and the dollar amount of withdrawals. the program then has to calculate the balance

Check whether a number is palindrome or not, Function IsPalindrome(str) ...

Function IsPalindrome(str) Dim iStart,iEnd,ctr,blnPalin str=trim(str) blnPalin=true iEnd=len(str) iCnt=round(iEnd / 2) iStart=1 for ctr=1 to cint(iCnt) if(mid(str,iEnd,

Data types, what are the basic vb data types

what are the basic vb data types

Windows 32 bit (win 32) applications, WINDOWS 32 BIT (WIN 32) APPLICATIONS ...

WINDOWS 32 BIT (WIN 32) APPLICATIONS   The Win 32 based applications are the applications developed for the windows family of the operating systems. The Win 32 applications ac

Create a calculator application, Create a VB calculator application that ap...

Create a VB calculator application that appears as in the screen shots below. The user enters numbers in the textboxes labelled Number 1 and Number 2. When a calculati

Mdi application - types of project using visual c++, MDI Application: ...

MDI Application: The MDI application utilizes the main frame window as the work space in which the user can open more document frame windows.

Collection is adding last record, Please help me.. I am loading data from ...

Please help me.. I am loading data from a text file to a class (Item Inventory from Tony Gaddis - Visual Basic - Chapter 12 -programming challange# 7-9) and the last item loaded is

Add Vbscript code to an html page, You can employ the SCRIPT element to add...

You can employ the SCRIPT element to add VBScript code to an HTML page. The SCRIPT Tag VBScript code is written inside paired SCRIPT tags. For instance, a process to test

Vbscript operators, VBScript Operators VBScript contain a full range of...

VBScript Operators VBScript contain a full range of operators, including comparison operators, arithmetic operators, concatenation operators, and logical operators.

Naming restrictions, For naming anything variable names follow the standard...

For naming anything variable names follow the standard rules in VBScript. A variable name: Should begin with an alphabetic character. Cannot have an embedded period. Sh

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd