Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

When I try to loop through an arraylist that I have created, my machine hangs and then visual studio produces a stack overflow error, I obviously doing something wrong, can someone help???

 

dim myArraylist as new arraylist()

myArraylist.add("simon")
myArraylist.add("simon1")
myArraylist.add("simon2")
myArraylist.add("simon3")

dim i as integer

for i = 0 to myArraylist.count
 msgbox(myArraylist(i))
next 

 

Cheer

 

Simon

Posted

it does not call any other method and unfortunately I do not have vs on this machine so am unable to let you know the line number (quite an important bit of info really).

 

But as far as you are aware is the above code written correctly???

 

Cheers

 

Simon

  • Administrators
Posted

Can't see anything there that would call a stack overflow. You will get an IndexOutOfRangeException though as you need to loop to myArraylist.count - 1 though.

Are you sure that is the code / method that is failing? What is the method itself called?

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

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...