How To Count Words In A String Using Visual Basic.Net
In This VB.Net Tutorial We Will See How To Count The Number Of Words In A TextBox Text Using Visual Basic.Net Programming Language And Visual Studio Editor.
Project Source Code:
Public Class VbWordsCount
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim txt As String
txt = TextBox1.Text
Dim separ() As Char = {" "}
Dim count As Integer
count = txt.Split(separ, StringSplitOptions.RemoveEmptyEntries).Length
MsgBox(count.ToString())
End Sub
End Class
///////////////OUTPUT:
Download Projects Source Code