Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Why do I get 'Specified argument was out of the range of valid values.'?

 

Dim z as integer = 0
       While srReader.Peek() > -1
           z += 1
           ListBox(1).Items.Item(z) = srReader.ReadLine()
           ListBox(1).Items.Add(ListBox(1).Items.Item(z))
       End While

 

Total it is supposed to load a little over 7000 lines into the listbox. I don't know if this has anything to do with it.

To err is human, to really foul things up requires a computer.
  • *Experts*
Posted
Its probably because you add one to z before doing anything to the listbox and it overflows by one. Try putting z =+ 1 after modifying the listbox.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...