MKS_269
Console Collector
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1
300 XP
For this article, we will create a program that will count the number of words in a TextBox. But we will just use the RichTextBox instead of TextBox :)
Now, let's start this tutorial!
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.
2. Next, add one RichTextBox named RichTextBox1 and a Button named Button1 labeled as "Get Number of Words". You must design your layout like this:
3. Now put add this code for your code module. This code is for Button1_Click. This will trigger to count the number of words in your RichTextBox.
Explanation:
We have initialized variable strInput as String to hold the value inputted in the RichTextBox. We also declare variable strSplit as string to split the words inputted in the RichTextBox. We use the CChar function to find the spacing of the text. Then we create a MessageBox to display the number of words using the Length function.
Output:
Download the source code and try it!
For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Best Regards,
Engr. Lyndon R. Bermoy
IT Instructor/System Developer/Android Developer
Mobile: 09079373999
Telephone: 826-9296
E-mail:[email protected]
Visit and like my page on Facebook at: Bermz ISware Solutions
Subscribe at my YouTube Channel at: SerBermz
Download
Now, let's start this tutorial!
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.
2. Next, add one RichTextBox named RichTextBox1 and a Button named Button1 labeled as "Get Number of Words". You must design your layout like this:

3. Now put add this code for your code module. This code is for Button1_Click. This will trigger to count the number of words in your RichTextBox.
- Private
Sub
Button1_Click(
ByVal
sender As
System.
Object
, ByVal
e As
System.
EventArgs
)
Handles
Button1.
Click
- Dim
strInput As
String
- strInput =
RichTextBox1.
Text
- Dim
strSplit(
)
As
String
- strSplit =
strInput.
Split
(
CChar
(
" "
)
)
- MsgBox
(
"Number of words: "
&
strSplit.
Length
)
- End
Sub
Explanation:
We have initialized variable strInput as String to hold the value inputted in the RichTextBox. We also declare variable strSplit as string to split the words inputted in the RichTextBox. We use the CChar function to find the spacing of the text. Then we create a MessageBox to display the number of words using the Length function.
Output:

Download the source code and try it!
For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Best Regards,
Engr. Lyndon R. Bermoy
IT Instructor/System Developer/Android Developer
Mobile: 09079373999
Telephone: 826-9296
E-mail:[email protected]
Visit and like my page on Facebook at: Bermz ISware Solutions
Subscribe at my YouTube Channel at: SerBermz
Download
You must upgrade your account or reply in the thread to view hidden text.