Sometimes when entering text in an input field we want to know how many words we have entered. For example: Please provide a description of the damage (Maximum 500 words). It is easy to find out the number of characters entered in a text box, but to get the number of words using Visual Basic we need to put in a little more effort. The VB source code below demonstrates how we can do this.
To try out this source sample create a new VB6 program. Add a text box to the form and a command button. Double click the command button to get into its click event handler. Inside this method add the following code.