Sign in to follow this  

Infinite Arrays (MSVS 2005)

This topic is 4378 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My line of code:
Microsoft.VisualBasic.FileSystem.FileOpen(1, "Main.qs", OpenMode.Input, OpenAccess.Read)
        While Not Microsoft.VisualBasic.FileSystem.EOF(1)
            Line = Microsoft.VisualBasic.FileSystem.LineInput(1)

            If InStr(Line, "block") Then
                ReDim Preserve CodeBlocks(Index)
                CodeBlocks(Index) += Line              ' It worked fine here..

                While Not Block
                    Line = Microsoft.VisualBasic.FileSystem.LineInput(1)
                    CodeBlocks(Index) += vbCrLf + Line ' ERROR HERE

                    If InStr(Line, "end block") = 1 Then
                        Index += 1
                        Block = False
                    End If
                End While

                Block = True
            End If

            ExecuteBlocks()

        End While


"Index was outside the bounds of the array." is the error that I get. I was directed to here.. Obviously it was not very helpful. The index is not a negative number, and it was 2 when I debugged. My declarations:
Dim CodeBlocks As String()
Dim Index as Long = 0


(IndexOutOfRangeException was unhandled)

Share this post


Link to post
Share on other sites
What if you move the ()?

Dim CodeBlocks() as String


Just curious. I haven't used much of VB.NET, but I remember you could do it like that in earlier versions

Share this post


Link to post
Share on other sites

This topic is 4378 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this