Question Index Out Of Range Exception was unhandeld

Beware

Member
Joined
Dec 4, 2012
Messages
7
Programming Experience
3-5
I get this error:
Probleem.png

What is wrong with my code?
 

22-degrees

Well-known member
Joined
Feb 11, 2012
Messages
156
Location
South East Ireland
Programming Experience
1-3
I would prefer to see you make the effort yourself. If you understand what the code you use does, then you can be a much better coder moving forward.

You have the Autos window open, the information is right there.. Try creating a variable to store the ofd.FileName.Count -1 value and see what the value is.. Then you will see why you are getting the OutOfRange error..
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,589
Location
Norway
Programming Experience
10+
oft.FileNames, not ofd.FileName.
 

Beware

Member
Joined
Dec 4, 2012
Messages
7
Programming Experience
3-5
I would prefer to see you make the effort yourself. If you understand what the code you use does, then you can be a much better coder moving forward.

You have the Autos window open, the information is right there.. Try creating a variable to store the ofd.FileName.Count -1 value and see what the value is.. Then you will see why you are getting the OutOfRange error..

I know what I'm coding, i just made a typographical mistake. I read it 100 items but I just couldn't see it.

Thank you both!!!
 
Top Bottom