VB .NET

VB .NET

Slip11

Q.1)  Write a Vb.net program to accept sentences in text box and count the number of words and display the count in message box.    [Marks 20] 

Solution

Public Class Slip11

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

        Dim a As String

        Dim i, cnt As Integer

        a = TextBox1.Text

        Dim arr() As Char = a.ToCharArray()

        cnt = 1

        While i < arr.Length - 1

            If arr(i) = " " Then

                cnt = cnt + 1

            End If

            i = i + 1

        End While

        MsgBox("The total Word:" & cnt)

    End Sub

End Class

BCA Pratical Solution

My name is Vivek And I from Mumbai and Complete my Graduation Bca.my Age is 23 Years.

Post a Comment

Previous Post Next Post