home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD36902292000.psc / frmMain.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2000-02-29  |  3.7 KB  |  116 lines

  1. VERSION 5.00
  2. Begin VB.Form frmMain 
  3.    Caption         =   "Pig Latin Text Conversion"
  4.    ClientHeight    =   1335
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   4575
  8.    Icon            =   "frmMain.frx":0000
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   1335
  11.    ScaleWidth      =   4575
  12.    StartUpPosition =   2  'CenterScreen
  13.    Begin VB.CommandButton cmdExit 
  14.       Caption         =   "Exit Text Converter"
  15.       Height          =   375
  16.       Left            =   2400
  17.       TabIndex        =   3
  18.       Top             =   840
  19.       Width           =   2055
  20.    End
  21.    Begin VB.CommandButton cmdConvert 
  22.       Caption         =   "Convert Text to Pig Latin"
  23.       Default         =   -1  'True
  24.       Height          =   375
  25.       Left            =   120
  26.       TabIndex        =   2
  27.       Top             =   840
  28.       Width           =   2055
  29.    End
  30.    Begin VB.TextBox txtSource 
  31.       Height          =   285
  32.       Left            =   120
  33.       TabIndex        =   0
  34.       Top             =   240
  35.       Width           =   4335
  36.    End
  37.    Begin VB.Line Line2 
  38.       BorderColor     =   &H8000000D&
  39.       X1              =   120
  40.       X2              =   4440
  41.       Y1              =   720
  42.       Y2              =   720
  43.    End
  44.    Begin VB.Line Line1 
  45.       BorderColor     =   &H80000013&
  46.       BorderWidth     =   2
  47.       X1              =   120
  48.       X2              =   4440
  49.       Y1              =   720
  50.       Y2              =   720
  51.    End
  52.    Begin VB.Label lblSource 
  53.       Alignment       =   2  'Center
  54.       Caption         =   "Enter a phrase or word to convert to Pig Latin."
  55.       Height          =   255
  56.       Left            =   120
  57.       TabIndex        =   1
  58.       Top             =   0
  59.       Width           =   4335
  60.    End
  61. Attribute VB_Name = "frmMain"
  62. Attribute VB_GlobalNameSpace = False
  63. Attribute VB_Creatable = False
  64. Attribute VB_PredeclaredId = True
  65. Attribute VB_Exposed = False
  66. '-------------------------------------------------------
  67. ' Program: Pig Latin Text Conversion
  68. ' Objective: Convert sentence to Pig Latin format
  69. ' Author: Bradley Buskey
  70. ' Date: February 29, 2000
  71. '-------------------------------------------------------
  72. Option Explicit
  73. Private Sub Form_Load()
  74. '   Here we clear anything out of the text box.
  75.     txtSource.Text = ""
  76. End Sub
  77. Private Sub cmdConvert_Click()
  78. '   Variable Declaration
  79.     Dim Source() As String
  80.     Dim MsgTitle, MsgType, Temp, Hold, TextNum, FullText
  81.     Dim n As Integer
  82. '   Set up the Title and Type of message box.
  83.     MsgTitle = "Your Converted Message"
  84.     MsgType = vbInformation
  85. '   Bring in the entire phrase into an array split on a space.
  86.     Source() = Split(txtSource.Text, " ")
  87. '   Loop through from 0 to the final entry in the array.
  88.     For n = 0 To UBound(Source())
  89. '       Get the number of characters in the word.
  90.         TextNum = Len(Source(n))
  91.         
  92. '       Take the first character and save it to a temporary variable.
  93.         Temp = Left(Source(n), 1)
  94.         
  95. '       Take all the characters less the first on into a temporary variable.
  96.         Hold = Right(Source(n), TextNum - 1)
  97.         
  98. '       Remake the word, pig latin-style.
  99.         Source(n) = Hold & Temp & "ay"
  100.         
  101. '       Put the sentence back together.
  102.         FullText = FullText & " " & Source(n)
  103. '   Go to the next word.
  104.     Next n
  105. '   Display the re-done sentence in pig latin style.
  106.     MsgBox FullText, MsgType, MsgTitle
  107. End Sub
  108. Private Sub txtSource_DblClick()
  109. '   This is so it is easy to clear the textbox.
  110.     txtSource.Text = ""
  111. End Sub
  112. Private Sub cmdExit_Click()
  113. '   Pretty self explanitory, eh?
  114.     End
  115. End Sub
  116.