Counting characters, words and paragraphs in a text file or from a textbox.

I'm getting an error that StringType.Strcmp isn't declared.  Can someone please tell me where I'm going wrong?

Public Property StringContents() As String
        Get
            Return mstrString
        End Get
        Set(ByVal Value As String)
            pintCharacters = 0
            pintWords = 0
            pintSentences = 0
            pintParagraphs = 0
            mstrString = Value
            Dim text2 As String = Value
            Dim num2 As Integer = text2.Length
            If (num2 > 0) Then
                pintWords += 1
            End If
            Dim num3 As Integer = (num2 - 1)
            Dim num1 As Integer = 0
            Do While (num1 <= num3)
                pintCharacters += 1
                Dim text1 As String = text2.Substring(num1, 1)
                If (StringType.StrCmp(text1, " ", False) = 0) Then
                    pintWords += 1
                End If
                If (StringType.StrCmp(text1, ChrW(9), False) = 0) Then
                    pintWords = (pintWords + pintWords)
                End If
                If (StringType.StrCmp(text1, ".", False) = 0) Then
                    pintSentences += 1
                End If
                If (StringType.StrCmp(text1, ChrW(10), False) = 0) Then
                    pintParagraphs += 1
                End If
                num1 += 1
            Loop
        End Set
    End Property

    Public Sub OpenFile(ByVal pstrFileName As String)

        Dim reader1 As New StreamReader(pstrFileName)
        pintCharacters = 0
        pintWords = 0
        pintSentences = 0
        pintParagraphs = 0
        Dim text2 As String = reader1.ReadLine
        Do While (StringType.StrCmp(text2, Nothing, False) <> 0)
            pintParagraphs += 1
            Dim num2 As Integer = text2.Length
            pintWords += 1
            Dim num3 As Integer = (num2 - 1)
            Dim num1 As Integer = 0
            Do While (num1 <= num3)
                pintCharacters += 1
                Dim text1 As String = text2.Substring(num1, 1)
                If (StringType.StrCmp(text1, " ", False) = 0) Then
                    pintWords += 1
                End If
                If (StringType.StrCmp(text1, ChrW(9), False) = 0) Then
                    pintWords += 1
                End If
                If (StringType.StrCmp(text1, ".", False) = 0) Then
                    pintSentences += 1
                End If
                num1 += 1
            Loop
            mstrString = (mstrString & text2)
            text2 = reader1.ReadLine
        Loop
    End Sub
norrodjAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fernando SotoRetiredCommented:
What does the StringType class look like and where do you define it in your code?
sasidar_dCommented:
Hi

Instead of using StringType you can use the following

replace ur StringType.StrCmp with  String.Compare

for this u have to also import the system.io class

the third argument should be true instead of false which u have mentioned in ur coding


Hope this will solve your problem

Happy Programming

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.