September 08 2010 08:13:23
Navigation
· Home
· Online Store
· Course Outlines (PDF Files)
· Sample Videos
· Contact Info
· Web Links
· Articles (Sample Code)

Other Videos
· WordPress (CMS)
· Joomla (CMS)
· Sharepoint

Other
· FAQ
· Search
Contribute to This Site
· Submit Link
· Get Benefitted Sites
No Competition
One of our so-called competitors offers under 6 hours of video training for a whopping $219 (choke, gasp, spew - you could hire a private tutor for that price). Did I mention that they ship their training on VHS tapes (remember those?). Check out our 'Course Outlines' link above. We offer a 2-days of training (15 hours) for $54 (2 CDs at $29 each). You watch our videos from a CD/ROM on your computer. We also include real-world lab/assignments in each course.
Articles: FSO Dictionary Object
FSO Dictionary Object
 
'==========================================================================
' NAME: FSO_Dictionary_Obj1.vbs 
' AUTHOR: Neal Walters , Amerisoft Inc
' DATE  : 3/26/2005
' http://VBScript-Training.com 
'==========================================================================
Option Explicit 


   Dim dict, empnum 
      
   Set dict = CreateObject("Scripting.Dictionary")
   
   dict.Add 101, "John Doe" 
   dict.Add 102, "Fred Flinstone" 
   dict.Add 103, "Wilma Flinstone" 
   dict.Add 104, "Barnie Rubble" 
   dict.Add 222, "Betty Rubble" 
   
   empnum = -1 
   Do While empnum <> 0  
       empnum = InputBox("Type in an employee number:") 
       If empnum = "" Then
          empnum = 0 
          Exit Do 
       End If 
       empnum = CInt(empnum) 
       WScript.Echo "For empnum=" & empnum & " the employee name = " & dict.Item(empnum) 
   Loop 
   
'==========================================================================
' NAME: FSO_Dictionary_Obj2.vbs 
' AUTHOR: Neal Walters , Amerisoft Inc
' DATE  : 3/26/2005
' http://VBScript-Training.com 
'==========================================================================
Option Explicit 


   Dim dict, empnum, newname, oldname 
      
   Set dict = CreateObject("Scripting.Dictionary")
   
   dict.Add 101, "John Doe" 
   dict.Add 102, "Fred Flinstone" 
   dict.Add 103, "Wilma Flinstone" 
   dict.Add 104, "Barnie Rubble" 
   dict.Add 222, "Betty Rubble" 
   
   Dim newkey, newitem 
   
   empnum = -1 
   Do While empnum <> 0  
       empnum = InputBox("Type in an employee number of the employee you want to change or type in ADD or DEL:",,,1000,6000) 
       If empnum = "" Then
          empnum = 0 
          WScript.Echo "empnum = 0 so loop is stopping" 
          Exit Do 
       End If 
       If empnum = "ADD" Then 
          newkey = InputBox ("What is the key for the new employee:",,,1000,6000)
          newitem = InputBox ("What is the name for the new employee:,,,1000,6000") 
          dict.Add newkey, newitem 
          empnum = -1 
       ElseIf empnum = "DEL" Then 
          newkey = InputBox ("What is the key for the employee to be deleted:",,,1000,6000)
          dict.Remove cint(newkey) 
          empnum = -1 
       Else 
	       empnum = CInt(empnum) 
	       newname = InputBox("Type in new name for employee " & dict.Item(empnum),,,1000,6000 ) 
	       oldname = dict.Item(empnum) 
	       dict.Item(empnum)= newname 
	       WScript.Echo "For empnum=" & empnum & " old employee name = " & oldname & _ 
	                                             " and new name = " & newname 
       End If 
   Loop 
   
   
   WScript.Echo "Values of all employee names:" 
   
   Dim empArray, i, empkeys 
   empArray = dict.Items   ' Get the items/values
   empKeys = dict.Keys     ' Get the keys 
   
   For i = 0 To UBound(empArray) ' Iterate the array. 
      WScript.Echo i & " empnum=" & empKeys(i) & _ 
                      " empname=" & empArray (i) 
   Next



'==========================================================================
' NAME: FSO_Dictionary_Obj3.vbs 
' AUTHOR: Neal Walters , Amerisoft Inc
' DATE  : 3/26/2005
' http://VBScript-Training.com 
'==========================================================================
Option Explicit 

   Dim dict, empnum, newname, oldname, house1, house2,emp1 
      
   Set house1 = CreateObject("Scripting.Dictionary")
   Set house2 = CreateObject("Scripting.Dictionary")
   Set emp1 = CreateObject("Scripting.Dictionary")
   
   house1.Add "exterior","brick" 
   house1.Add "trimcolor","white" 
   house1.Add "sqft",2500 
   house1.Add "owner","John Doe" 
   house1.Add "address","123 Main Street" 
   house1.Add "city","Dallas"
   house1.Add "state","TX"
   house1.Add "zip","75080" 
   
   house2.Add "squarefeet",2500 
   house2.Add "trimcolor","yellow" 
   house2.Add "owner","Movie Star" 
   house2.Add "address","444 Star Island" 
   house2.Add "city","Miami"
   house2.Add "state","FL"
   
   
   emp1.Add "Name","John Doe" 
   emp1.Add "City","Naples"
   emp1.Add "State","Florida" 
   
   printAnyDictionaryObject house1,"House1"
   printAnyDictionaryObject house2,"Before Paint: House2" 
   Painthouse house2,"green"
   printAnyDictionaryObject house2,"After Paint: House2" 
   printAnyDictionaryObject emp1,"Emp1" 

   WScript.Echo "THE END "  
   
   '-------------------------------------------------------
   ' Nice subroutine to print any dictionary object 
   '-------------------------------------------------------
   sub printAnyDictionaryObject(mydictobj,mydescription)
   

   WScript.Echo "List all values in dictionary object=" & mydescription & VbCrLf 
   
   Dim myArray, i, myKeys 
   myArray = mydictobj.Items   ' Get the items/values
   myKeys = mydictobj.Keys     ' Get the keys 
   
   For i = 0 To UBound(myArray) ' Iterate the array. 
      WScript.Echo i & " key=" & myKeys(i) & _ 
                       "  value=" & myArray (i) 
   Next
   
   WScript.Echo " " 
   
   End Sub 
   
   Sub Painthouse(mydictobj, newcolor) 
      mydictobj.item("trimcolor") = newcolor 
   End Sub 



   
   



Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Order Now - View Products


Default Shipping:
Phone: 214-403-6006
Our Sites
Software Training
XML-Online-Training.com
Biztalk-Training.com
SharePoint-Training.com
DotNet-AddOns-Training.com
CMSTrainingVideos.com

Language
LanguageLovers.com
Render time: 0.01 seconds 432,187 unique visits