Exercise 16

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
Dim text As String() = TextBox1.Text.Split(" ")
Dim firstoflast As String = text(1).Substring(0, 1).ToLower
Dim alphabet As String() = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o",
"p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
Dim num As Integer = (Array.IndexOf(alphabet, firstoflast))

If num <= 8 Then


Label2.Text = TextBox1.Text + " is in Group 1!"
End If

If num > 8 And num <= 18 Then


Label2.Text = TextBox1.Text + " is in Group 2!"
End If

If num > 18 Then


Label2.Text = TextBox1.Text + " is in Group 3!"
End If

End Sub
End Class

You might also like