4 Replies - 329 Views - Last Post: 24 January 2013 - 10:33 PM Rate Topic: -----

#1 GodSosukeAizen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 24-January 13

Array out of bounds

Posted 24 January 2013 - 10:11 PM

 Dim User(5) As String

        Do While Reader.Peek() <> -1
            LineRead = Reader.ReadLine()
            User = LineRead.Split(",")

            If User(2) = Txt_Username.Text And User(3) = Txt_Password.Text Then
                Homepage.Show()
                Me.Hide()
            Else
                MsgBox("Invalid Username and Password combination. Please try again.")
            End If
        Loop


        Reader.Close()


I'm not sure what is causing the problem.

Is This A Good Question/Topic? 0
  • +

Replies To: Array out of bounds

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9287
  • View blog
  • Posts: 34,811
  • Joined: 12-June 08

Re: Array out of bounds

Posted 24 January 2013 - 10:13 PM

Put a breakpoint after line 5 and see if your array of strings actually has enough indexes that you can reference 2 and 3.
Was This Post Helpful? 0
  • +
  • -

#3 GodSosukeAizen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 24-January 13

Re: Array out of bounds

Posted 24 January 2013 - 10:27 PM

It doesn't seem to be putting anything inside as i step through the code
on the step before it breaks i get a refresh symbol that when i hover over it it says the value of this expression may be incorrect, it could not be evaluated because index 5 for dimendion 0 is out of range.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9287
  • View blog
  • Posts: 34,811
  • Joined: 12-June 08

Re: Array out of bounds

Posted 24 January 2013 - 10:28 PM

Well.. there you go then. So your split isn't working on what ever text you think you are splitting.
Was This Post Helpful? 0
  • +
  • -

#5 GodSosukeAizen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 24-January 13

Re: Array out of bounds

Posted 24 January 2013 - 10:33 PM

Had a blank line for the first line in the text file
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1