Sign in with
Sign up | Sign in
Your question

Problem With Vb

Last response: in Applications
Share
November 30, 2009 1:53:19 PM

Im Doing Some simple programming in vb for a lesson im teaching on the phonetic alphabet that i need solved in 2 days. when i go to play the audio it skips the first word of every line.

here is the code:

Public Class Form1
Dim original, Ongoing, been, index() As String
Private Sub Translate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Translate.Click
original = ToBe.Text
original = original.ToLower
Ongoing = ""
For i As Integer = 0 To original.Length - 1
If original(i) = "a" Then
Ongoing = Ongoing & "Alpha "
ElseIf original(i) = "b" Then
Ongoing = Ongoing & "Bravo "
ElseIf original(i) = "c" Then
Ongoing = Ongoing & "Charlie "
ElseIf original(i) = "d" Then
Ongoing = Ongoing & "Delta "
ElseIf original(i) = "e" Then
Ongoing = Ongoing & "Echo "
ElseIf original(i) = "f" Then
Ongoing = Ongoing & "Foxtrot "
ElseIf original(i) = "g" Then
Ongoing = Ongoing & "Golf "
ElseIf original(i) = "h" Then
Ongoing = Ongoing & "Hotel "
ElseIf original(i) = "i" Then
Ongoing = Ongoing & "India "
ElseIf original(i) = "j" Then
Ongoing = Ongoing & "Juliet "
ElseIf original(i) = "k" Then
Ongoing = Ongoing & "Kilo "
ElseIf original(i) = "l" Then
Ongoing = Ongoing & "Lima "
ElseIf original(i) = "m" Then
Ongoing = Ongoing & "Mike "
ElseIf original(i) = "n" Then
Ongoing = Ongoing & "November "
ElseIf original(i) = "o" Then
Ongoing = Ongoing & "Oscar "
ElseIf original(i) = "p" Then
Ongoing = Ongoing & "Papa "
ElseIf original(i) = "q" Then
Ongoing = Ongoing & "Quebec "
ElseIf original(i) = "r" Then
Ongoing = Ongoing & "Romeo "
ElseIf original(i) = "s" Then
Ongoing = Ongoing & "Sierra "
ElseIf original(i) = "t" Then
Ongoing = Ongoing & "Tango "
ElseIf original(i) = "u" Then
Ongoing = Ongoing & "Uniform "
ElseIf original(i) = "v" Then
Ongoing = Ongoing & "Victor "
ElseIf original(i) = "w" Then
Ongoing = Ongoing & "Whiskey "
ElseIf original(i) = "x" Then
Ongoing = Ongoing & "X-Ray "
ElseIf original(i) = "y" Then
Ongoing = Ongoing & "Yankee "
ElseIf original(i) = "z" Then
Ongoing = Ongoing & "Zulu "
ElseIf original(i) = "1" Then
Ongoing = Ongoing & "Wun "
ElseIf original(i) = "2" Then
Ongoing = Ongoing & "Too "
ElseIf original(i) = "3" Then
Ongoing = Ongoing & "Tree "
ElseIf original(i) = "4" Then
Ongoing = Ongoing & "Fower "
ElseIf original(i) = "5" Then
Ongoing = Ongoing & "Fife "
ElseIf original(i) = "6" Then
Ongoing = Ongoing & "Six "
ElseIf original(i) = "7" Then
Ongoing = Ongoing & "Seven "
ElseIf original(i) = "8" Then
Ongoing = Ongoing & "Ait "
ElseIf original(i) = "9" Then
Ongoing = Ongoing & "Niner "
ElseIf original(i) = "0" Then
Ongoing = Ongoing & "Zero "
ElseIf original(i) = " " Then
Ongoing = Ongoing & vbCrLf & vbCrLf
End If
Phonetic.Text = Ongoing
Next

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
been = Phonetic.Text.ToLower
index = been.Split(" ")
For i As Integer = 0 To UBound(index)
If index(i) = "alpha" Then
My.Computer.Audio.Play(My.Resources.Alpha, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "bravo" Then
My.Computer.Audio.Play(My.Resources.Bravo, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "charlie" Then
My.Computer.Audio.Play(My.Resources.Charlie, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "delta" Then
My.Computer.Audio.Play(My.Resources.Delta, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "echo" Then
My.Computer.Audio.Play(My.Resources.Echo, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "foxtrot" Then
My.Computer.Audio.Play(My.Resources.Foxtrot, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "golf" Then
My.Computer.Audio.Play(My.Resources.Golf, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "hotel" Then
My.Computer.Audio.Play(My.Resources.Hotel, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "india" Then
My.Computer.Audio.Play(My.Resources.India, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "juliet" Then
My.Computer.Audio.Play(My.Resources.Juliet, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "kilo" Then
My.Computer.Audio.Play(My.Resources.Kilo, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "lima" Then
My.Computer.Audio.Play(My.Resources.Lima, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "mike" Then
My.Computer.Audio.Play(My.Resources.Mike, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "november" Then
My.Computer.Audio.Play(My.Resources.November, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "oscar" Then
My.Computer.Audio.Play(My.Resources.Oscar, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "papa" Then
My.Computer.Audio.Play(My.Resources.Papa, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "quebec" Then
My.Computer.Audio.Play(My.Resources.Quebec, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "romeo" Then
My.Computer.Audio.Play(My.Resources.Romeo, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "sierra" Then
My.Computer.Audio.Play(My.Resources.Sierra, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "tango" Then
My.Computer.Audio.Play(My.Resources.Tango, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "uniform" Then
My.Computer.Audio.Play(My.Resources.Uniform, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "victor" Then
My.Computer.Audio.Play(My.Resources.Victor, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "whiskey" Then
My.Computer.Audio.Play(My.Resources.Whiskey, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "x-ray" Then
My.Computer.Audio.Play(My.Resources.X_Ray, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "yankee" Then
My.Computer.Audio.Play(My.Resources.Yankee, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "zulu" Then
My.Computer.Audio.Play(My.Resources.Zulu, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "wun" Then
My.Computer.Audio.Play(My.Resources.Wun, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "too" Then
My.Computer.Audio.Play(My.Resources.Too, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "tree" Then
My.Computer.Audio.Play(My.Resources.Tree, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "fower" Then
My.Computer.Audio.Play(My.Resources.Fower, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "fife" Then
My.Computer.Audio.Play(My.Resources.Fife, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "six" Then
My.Computer.Audio.Play(My.Resources.Six, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "seven" Then
My.Computer.Audio.Play(My.Resources.Seven, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "ait" Then
My.Computer.Audio.Play(My.Resources.Ait, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "niner" Then
My.Computer.Audio.Play(My.Resources.Niner, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf index(i) = "zero" Then
My.Computer.Audio.Play(My.Resources.Zero, AudioPlayMode.Background)
System.Threading.Thread.Sleep(1270)
ElseIf original(i) = vbCrLf Then
System.Threading.Thread.Sleep(3000)
End If
Next
End Sub
End Class

More about : problem

November 30, 2009 2:19:29 PM

a=b, assigns b to z.

Now, a==b, check if a is equal to b.
m
0
l
!