Count words in Visual Basic
问题 I am trying to implement a programme that counts the words in a multiline textbox as you type. I can get it counting the words until I press the "enter" key and type a word. It does not recognise this. This is my code: Private Sub TextBox1_TextChanged(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles TextBox1.TextChanged Dim str As String Dim i, l, words As Integer str = TextBox1.Text str = LTrim(str) 'removes blank spaces at the beginning of text str = RTrim(str) '