.NET Practical Slip 21 Q A

Answer:

Public Class Form1

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

        Dim str As String

        str = TextBox1.Text

        Dim I, Count As Integer

        Dim arr() As Char = str.ToCharArray

        For I = 0 To arr.Length - 1

            If arr(I) = " " Then

                Count = Count + 1

            End If

        Next

        MsgBox(Count + 1 & " words")

    End Sub

End Class
Spread the love

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top