Jump to content
  • Advertisement
Sign in to follow this  
orcfan32

Infinite Arrays (MSVS 2005)

This topic is 4571 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!