PROPERTIES:
CODEING:
Button1 | |
Text | Analysis |
Label1,Label2,Label3,Label4,Label5 | |
Text | (Empty) |
Public Class Form1
Dim vowels, consonants, space, digit, special_symbols As Integer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim s As Char() = TextBox1.Text.ToLower().ToCharArray()
For Each c As Char In s
If c >= "a" And c <= "z" Then
If c = "a" Or c = "e" Or c = "i" Or c = "o" Or c = "u" Then
vowels += 1
Else
consonants += 1
End If
ElseIf c >= "0" And c <= "9" Then
digit += 1
ElseIf c = " " Then
space += 1
Else
special_symbols += 1
End If
Next c
Label1.Text = "Number of vowels:" & vowels
Label2.Text = "Number of Consonants:" & consonants
Label3.Text = "Number of spaces:" & space
Label4.Text = "Number of digits:" & digit
Label5.Text = "Number of special symbols:" & special_symbols
End Sub
End Class
DESIGNING:Dim vowels, consonants, space, digit, special_symbols As Integer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim s As Char() = TextBox1.Text.ToLower().ToCharArray()
For Each c As Char In s
If c >= "a" And c <= "z" Then
If c = "a" Or c = "e" Or c = "i" Or c = "o" Or c = "u" Then
vowels += 1
Else
consonants += 1
End If
ElseIf c >= "0" And c <= "9" Then
digit += 1
ElseIf c = " " Then
space += 1
Else
special_symbols += 1
End If
Next c
Label1.Text = "Number of vowels:" & vowels
Label2.Text = "Number of Consonants:" & consonants
Label3.Text = "Number of spaces:" & space
Label4.Text = "Number of digits:" & digit
Label5.Text = "Number of special symbols:" & special_symbols
End Sub
End Class
Comments
Post a Comment