Write a Vb.net program to accept sentences in text box and count the number of words and display the count in message box.

Slip No 11

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sentence As String
        Dim i As Integer
        Dim wc As Integer
        sentence = TextBox1.Text
        Dim arr() As Char = sentence.ToCharArray
        For i = 0 To arr.Length - 1
            If arr(i) = " " Then
                wc = wc + 1
            End If
        Next
        MsgBox("Total Words : " & wc + 1)
    End Sub
End Class

Comments

  1. The main motive of the Hadoop big data solution is to spread the knowledge so that they can give more big data engineers to the world.

    ReplyDelete

Post a Comment

Popular posts from this blog

Write a Vb.net program to accept a character from keyboard and check whether it is vowel or not. Also display the case of that character.

Write a Vb.net program to check whether entered string is palindrome or not.

Write a Vb.net program for blinking an image.