Click here to Skip to main content
13,139,515 members (53,383 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Dim LookAhead() As Char
    Dim Counter As Integer
    Dim Character() As String
    'Method to scan input
    Public Sub LexicalAnalyzer()
        Dim Length As Integer
        Index = 0
        Length = Len(RichTextBoxInput.Text)
        Dim i As Integer = 0
            Dim InputLength As Integer

            InputLength = Len(RichTextBoxInput.Text)

            Do While i <= InputLength
                LookAhead = RichTextBoxInput.Text.Substring(i)
                If Mid(LookAhead, 1, 1) = " " Then
                    Index = Index + 1
'The error is in this part
                    Character(Index) = Mid(LookAhead, 1, 1)
                End If
                i = i + 1


        Catch ex As Exception
        End Try
    End Sub
Posted 22-Sep-12 16:55pm
Updated 22-Sep-12 17:02pm
Wes Aday104.2K

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Yes. Running this through the debugger, you could easily find this and fix it yourself. You are trying to use an object that is null or call a method on an object that is null.
Janna Dela Cruz 22-Sep-12 23:26pm
thanks! got it..
Voted 4. You should have mentioned "de-referencing null" or "attempt to access any instance member of an object which is null". I mean, not just method.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170915.1 | Last Updated 22 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100