Sabtu, 02 November 2013
Menampilkan Jumlah Karakter, Kata & Huruf Hidup Menggunakan VB Net
Public Class Form1
Private Sub btnProses_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnProses.Click
Dim
jumlah As Double
= Len(Kalimat.Text)
Dim jkata As
Integer = 0
Dim jhidup As Integer = 0
Dim xkarakter As Char
Dim i As Integer
For i = 1 To jumlah
xkarakter = Microsoft.VisualBasic.Mid(Kalimat.Text, i, 1)
If xkarakter = "
" Then
jkata = jkata + 1
ElseIf UCase(xkarakter) = "A"
Or UCase(xkarakter) = "I"
Or UCase(xkarakter) = "U"
Or UCase(xkarakter) = "E"
Or UCase(xkarakter) = "O"
Then
jhidup =
jhidup + 1
End
If
Next
Label2.Text = "Jumlah
karakter : " & jumlah & vbCrLf & _
"Jumlah
kata : " & jkata + 1 & vbCrLf & _
"Jumlah
huruf hidup : " & jhidup
End Sub
End Class
Tampilan hasilnya terlihat seperti gambar berikut ini :
Demikian program menampilkan jumlah Karakter, Kata & Huruf Hidup menggunakan VB Net semoga bermanfaat.
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar