This Visual Basic code counts the number of vowels in text entered into a text box. When a button is clicked, it loops through each character in the input, checks if it is a vowel, and increments a counter if it is. It then displays the input text and the vowel count on a label.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
26 views
Exercise 12
This Visual Basic code counts the number of vowels in text entered into a text box. When a button is clicked, it loops through each character in the input, checks if it is a vowel, and increments a counter if it is. It then displays the input text and the vowel count on a label.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click Dim allvowels As String Dim input As String = TextBox1.Text allvowels = "aeiouy" Dim num As Integer = 0 For Each c As Char In input If allvowels.Contains(c) Then num = num + 1 End If Next Label2.Text = Label2.Text + " " + input + " is: " + num.ToString End Sub End Class
APznzabQWkwKaG MMt2BqKWG4o2gPw9rEhD41Adg8VtkG99p65at0kD0Otvy6dPjXIcG0Is2VwbIABD6qBQ5JsXwkKAXkUGqh8nx4FWO0YszkAYftl0Y1GTipAEuKK6Mz4 GRE 7vT8kDmuB3Ff6IhK8KAJkEGuvaDDIa16B4zJoC NriSyY4yYgNhkzDMaR4Lom2InUuAE4zQuGcmE2cgSUbdkkaHqs8mpVkj5z071