Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
''''''''''''''''''''''''''''''''''''''''''''
'Variable declaration section
''''''''''''''''''''''''''''''''''''''''''''
Dim intWordCount As Integer = 0
Dim intSentences As Integer = 0
Dim intParagraphs As Integer = 0
Dim WordsTotal As Integer
Dim intvbL As Integer
Dim count As Integer
''''''''''''''''''''''''''''''''''''''''''''
'Total Characters in text box section
''''''''''''''''''''''''''''''''''''''''''''
'If InStr(txtTextScan.Text, Microsoft.VisualBasic.ControlChars.Lf) > 0 Then MsgBox("Found LineFeed Character(s).")
Dim sInputText As String = txtTextScan.Text.Replace(Microsoft.VisualBasic.ControlChars.CrLf, "")
'Uncomment these lines if you find you need/want them
'sInputText = sInputText.Replace(Microsoft.VisualBasic.ControlChars.Lf, "")
'sInputText = sInputText.Replace(Microsoft.VisualBasic.ControlChars.Cr, "")
Dim iCharacterCount As Integer = 0
If sInputText = "" Then
WordsTotal = iCharacterCount - intvbL
lblCharactersTotals.Text = WordsTotal.ToString
Else
iCharacterCount = sInputText.Length
lblCharactersTotals.Text = iCharacterCount.ToString
End If
''''''''''''''''''''''''''''''''''''''''''''
'Total Words in text box section
''''''''''''''''''''''''''''''''''''''''''''
Dim strWords() As String
strWords = Split(txtTextScan.Text, ".")
For count = 0 To UBound(strWords)
If txtTextScan.Text = " " Then
intWordCount = 0
If Len(strWords(count)) > 0 Then
intWordCount = intWordCount + 1
End If
End If
Next
lblWordsTotals.Text = intWordCount.ToString
''''''''''''''''''''''''''''''''''''''''''''
'Total Sentences in text box
''''''''''''''''''''''''''''''''''''''''''''
Dim strLines() As String
strLines = Split(txtTextScan.Text, ".")
For count = 1 To UBound(strLines)
If txtTextScan.Text = " " Then
intSentences = 0
Else
If Len(strLines(count)) > 0 Then
intSentences = intSentences + 1
End If
End If
Next
lblSentencesTotals.Text = intSentences.ToString
''''''''''''''''''''''''''''''''''''''''''''
'Total Paragraphs in text box section
''''''''''''''''''''''''''''''''''''''''''''
Dim strParagraphs() As String
strLines = Split(txtTextScan.Text, Microsoft.VisualBasic.ControlChars.Lf)
For count = 0 To UBound(strLines)
If Len(strLines(count)) > 0 Then
intParagraphs = intParagraphs + 1
End If
Next
lblParagraphsTotals.Text = intParagraphs.ToString
intvbL = intParagraphs
End Sub