Click here to Skip to main content
12,506,338 members (54,713 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB VB.NET
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
 
        Try
            Dim InputLength As Integer
 

            InputLength = Len(RichTextBoxInput.Text)
 

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

 

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

1 solution

Rate this: bad
 
good
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.
  Permalink  
Comments
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.
--SA

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 | Mobile
Web02 | 2.8.160927.1 | Last Updated 22 Sep 2012
Copyright © CodeProject, 1999-2016
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