Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class frmConverter
  2.  
  3.     Private Sub btnConvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvert.Click
  4.         Dim word, position, cons, last As String
  5.         Dim vow As Integer = 0
  6.         word = txtInput.Text.ToLower()
  7.         position = txtInput.Text.Substring(0, 1)
  8.         If txtInput.Text.Length >= 3 Then
  9.             If position = "a" Or position = "e" Or position = "i" Or position = "o" Or position = "u" Then
  10.                 txtOutput.Text = word & "way"
  11.             ElseIf txtInput.Text.Contains("a") Then
  12.                 vow = txtInput.Text.IndexOf("a")
  13.                 cons = txtInput.Text.Substring(0, vow)
  14.                 last = txtInput.Text.Substring(vow)
  15.                 txtOutput.Text = last & cons & "ay"
  16.             ElseIf txtInput.Text.Contains("e") Then
  17.                 vow = txtInput.Text.IndexOf("e")
  18.                 cons = txtInput.Text.Substring(0, vow)
  19.                 last = txtInput.Text.Substring(vow)
  20.                 txtOutput.Text = last & cons & "ay"
  21.             ElseIf txtInput.Text.Contains("i") Then
  22.                 vow = txtInput.Text.IndexOf("i")
  23.                 cons = txtInput.Text.Substring(0, vow)
  24.                 last = txtInput.Text.Substring(vow)
  25.                 txtOutput.Text = last & cons & "ay"
  26.             ElseIf txtInput.Text.Contains("o") Then
  27.                 vow = txtInput.Text.IndexOf("o")
  28.                 cons = txtInput.Text.Substring(0, vow)
  29.                 last = txtInput.Text.Substring(vow)
  30.                 txtOutput.Text = last & cons & "ay"
  31.             ElseIf txtInput.Text.Contains("u") Then
  32.                 vow = txtInput.Text.IndexOf("u")
  33.                 cons = txtInput.Text.Substring(0, vow)
  34.                 last = txtInput.Text.Substring(vow)
  35.                 txtOutput.Text = last & cons & "ay"
  36.             End If
  37.             Else
  38.                 MessageBox.Show("word must be at least 3 letters long", "ERROR")
  39.             End If
  40.     End Sub
  41. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement