home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / PROGRAMS / CH6 / 6-2-4.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-11-02  |  2.0 KB  |  67 lines

  1. VERSION 5.00
  2. Begin VB.Form frmWords 
  3.    Caption         =   "Word Analysis"
  4.    ClientHeight    =   1455
  5.    ClientLeft      =   1170
  6.    ClientTop       =   1620
  7.    ClientWidth     =   3870
  8.    BeginProperty Font 
  9.       Name            =   "MS Sans Serif"
  10.       Size            =   8.25
  11.       Charset         =   0
  12.       Weight          =   700
  13.       Underline       =   0   'False
  14.       Italic          =   0   'False
  15.       Strikethrough   =   0   'False
  16.    EndProperty
  17.    LinkTopic       =   "Form1"
  18.    PaletteMode     =   1  'UseZOrder
  19.    ScaleHeight     =   1455
  20.    ScaleWidth      =   3870
  21.    Begin VB.PictureBox picReport 
  22.       Height          =   495
  23.       Left            =   120
  24.       ScaleHeight     =   435
  25.       ScaleWidth      =   3555
  26.       TabIndex        =   1
  27.       Top             =   840
  28.       Width           =   3615
  29.    End
  30.    Begin VB.CommandButton cmdAnalyze 
  31.       Caption         =   "Analyze Words"
  32.       Height          =   495
  33.       Left            =   720
  34.       TabIndex        =   0
  35.       Top             =   120
  36.       Width           =   2415
  37.    End
  38. Attribute VB_Name = "frmWords"
  39. Attribute VB_GlobalNameSpace = False
  40. Attribute VB_Creatable = False
  41. Attribute VB_PredeclaredId = True
  42. Attribute VB_Exposed = False
  43. Private Sub cmdAnalyze_Click()
  44.   Dim orderFlag As Boolean, wordCounter As Integer
  45.   Dim word1 As String, word2 As String
  46.   'Count words.  Are they in alphabetical order?
  47.   orderFlag = True   'Assume words are in alphabetical order
  48.   wordCounter = 0
  49.   word1 = ""
  50.   Open App.Path & "\WORDS.TXT" For Input As #1
  51.   Do While Not EOF(1)
  52.     Input #1, word2
  53.     wordCounter = wordCounter + 1
  54.     If word1 > word2 Then    'Two words are out of order
  55.         orderFlag = False
  56.     End If
  57.     word1 = word2
  58.   Loop
  59.   Close #1
  60.   picReport.Print "The number of words is"; wordCounter
  61.   If orderFlag = True Then
  62.       picReport.Print "The words are in alphabetical order."
  63.     Else
  64.       picReport.Print "The words are not in alphabetical order."
  65.   End If
  66. End Sub
  67.