home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code2 / str_plus / tokens.frm < prev    next >
Text File  |  1994-07-19  |  3KB  |  83 lines

  1. VERSION 2.00
  2. Begin Form Tokens 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Tokens"
  6.    ClientHeight    =   5460
  7.    ClientLeft      =   1095
  8.    ClientTop       =   1485
  9.    ClientWidth     =   7590
  10.    ControlBox      =   0   'False
  11.    Height          =   5865
  12.    Left            =   1035
  13.    LinkTopic       =   "Form2"
  14.    ScaleHeight     =   5460
  15.    ScaleWidth      =   7590
  16.    Top             =   1140
  17.    Width           =   7710
  18.    Begin CommandButton Command1 
  19.       BackColor       =   &H00C0C0C0&
  20.       Caption         =   "O &K A Y"
  21.       Height          =   375
  22.       Left            =   1800
  23.       TabIndex        =   1
  24.       Top             =   4800
  25.       Width           =   3975
  26.    End
  27.    Begin Label Label1 
  28.       Alignment       =   2  'Center
  29.       BackStyle       =   0  'Transparent
  30.       Caption         =   "Label1"
  31.       ForeColor       =   &H00000080&
  32.       Height          =   1335
  33.       Left            =   840
  34.       TabIndex        =   0
  35.       Top             =   3360
  36.       Width           =   5895
  37.    End
  38. End
  39. Dim TheseAnimals$()
  40. Dim AnimalCount As Integer
  41.  
  42. Dim TheseFruit$()
  43. Dim FruitCount As Integer
  44.  
  45. Sub Command1_Click ()
  46.     Unload Me
  47. End Sub
  48.  
  49. Sub Form_Load ()
  50.     FormCenterScreen Me
  51.     
  52.     DataAnimals$ = "cat,dog,bat,aardvark,frog,elephant"
  53.     'TheseAnimals$() was declared as an open array in the 'general' procedure
  54.     'DataAnimals$ is the string with the data elements
  55.     'AnimalCount will contain the total count of elements upon completion
  56.     ReadData TheseAnimals$(), DataAnimals$, AnimalCount
  57.     'the elements are printed in the Paint event
  58.     SortArray TheseAnimals$(), LBound(TheseAnimals$), UBound(TheseAnimals$)
  59.  
  60.     DataFruit$ = "banana,apple,cherry,date"
  61.     ReadData TheseFruit$(), DataFruit$, FruitCount
  62.     SortArray TheseFruit$(), LBound(TheseFruit$), UBound(TheseFruit$)
  63.  
  64.     nl$ = Chr$(13) + Chr$(10)
  65.     msg$ = "These two lists were read as Data in a very similar" + nl$
  66.     msg$ = msg$ + "manner to the old BASIC Data/Read statements.  This" + nl$
  67.     msg$ = msg$ + "is accomplished by FIRST declaring the array with an open" + nl$
  68.     msg$ = msg$ + "dimension, e.g., dim Array$().  Then, use the ReadData Sub" + nl$
  69.     msg$ = msg$ + "(which uses the StrPlus.DLL GetToken Sub) to actually read" + nl$
  70.     msg$ = msg$ + "each item into the array."
  71.     label1.Caption = msg$
  72.     Screen.MousePointer = 0
  73. End Sub
  74.  
  75. Sub Form_Paint ()
  76.     DoForm3D Me, sunken, 2, 5
  77.     Print
  78.     For x = 1 To AnimalCount: Print , TheseAnimals$(x): Next
  79.     Print : Print
  80.     For x = 1 To FruitCount: Print , TheseFruit$(x): Next
  81. End Sub
  82.  
  83.