So in this project I have to do...i have to make a Pig Latin Converter but I am having a bit of trouble(VB)

Aaron25b

New Member
Joined
Dec 3, 2014
Messages
2
This is part of my specifications and I am having trouble with it.

When converting from one language to another:
a. The words to be converted must be placed into an array with each element of the array containing one word.
b. When converting the words, each word must read from the array and converted.
c. This program must only have one array.
d. A single developer defined procedure must be used to populate the array.



having a little trouble keeping "hold' within the index while trying to move the words into the array
So whatever reason, hold does to -1 and that is what's making the error appear. What can I do to fix this?

Here is my code so far

Option Strict On
Public Class PigLatinForm
Private words(-1) As String
Private Sub exitToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles exitToolStripMenuItem.Click
Me.Close()
End Sub
Private Sub textBox_GotFocus(sender As Object, e As EventArgs) Handles inputTextBox.GotFocus
inputTextBox.SelectAll()
outputTextBox.SelectAll()
End Sub


Private Sub inputTextBox_KeyPress(sender As Object, e As KeyPressEventArgs) Handles inputTextBox.KeyPress
If e.KeyChar Like "[!a-z0-9 ]" AndAlso
e.KeyChar <> ControlChars.Back Then
e.Handled = True
End If
End Sub


Private Sub aboutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles aboutToolStripMenuItem.Click
MessageBox.Show( _
"Pig Latin Converter" _
& ControlChars.NewLine & "" _
& ControlChars.NewLine & "Version 1.00" _
& ControlChars.NewLine & "" _
& ControlChars.NewLine & "by Aaron Anguillara" _
& ControlChars.NewLine & "" _
& ControlChars.NewLine & "Copyright 2014", "About Pig Latin Converter", MessageBoxButtons.OK, _
MessageBoxIcon.None, MessageBoxDefaultButton.Button2)
End Sub


Private Sub PigLatinform_Load(sender As Object, e As EventArgs) Handles Me.Load
End Sub


Private Sub toPigLToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles toPigLToolStripMenuItem.Click
Dim hold As Integer
Dim word As String
Do Until inputTextBox.Text.Length = 0
hold = inputTextBox.Text.IndexOf(" ")
word = inputTextBox.Text.Substring(0, hold)
ReDim Preserve words(words.Length)
words(words.Length - 1) = inputTextBox.Text
Loop


outputTextBox.Text = inputTextBox.Text.ToString
If inputTextBox.Text.StartsWith("aeiou") Then
outputTextBox.Text.EndsWith("--way")
Else
End If


End Sub


End Class
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top