[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

VS 2005 ImageList Causing Error. My Application Will NOT Run!

Posted on 2006-07-06
6
Medium Priority
?
823 Views
Last Modified: 2008-01-09
I am trying to use a treeview and imagelist. I began trying to implement the imagelist halfway through the project, when I wanted to provide images to the treeview and listview I'm using to display data.

I added 3 images to the imagelist.

I have set the treeview's imagelist property to the imagelist I added to the form.

Here is some sample code for when I programmatically add nodes to the treeview.

nd = TreeView1.TopNode.Nodes.Add("", reader.ReadString, 0)

Then I tried:

nd.SelectedImageIndex = 0


I keep getting the following error, and it never points to the offending line of code. It seems there is no code error AS I ONLY HAVE TO ADD AN IMAGELIST TO THE FORM AND ADD ONE IMAGE TO IT FOR THIS ERROR TO OCCUR.

"An error occurred creating the form. See Exception.InnerException for details. The error is: Index was outside the bounds of the array."


OK, I created a BRAND NEW project.

1) added a treeview and listview to the form

2) added an imagelist to the form

3) added one image to the imagelist

4) did not link the imagelist to a control

5) ran the application. ERROR

Here is a screencap of the error: http://img518.imageshack.us/img518/3956/error2vo.png

P.S. Sorry about the points, but EE limits the points I can give for this.
0
Comment
Question by:programmer1024
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 8

Expert Comment

by:Shakti109
ID: 17054799

I can see that you state that you created a brand new project and added the controls/etc....But after replicating exactly your steps, the application starts up...

This may sound like a silly question but did you by any chance copy ANY code you had from the previous application into the new one?
0
 
LVL 4

Author Comment

by:programmer1024
ID: 17055397
>>I can see that you state that you created a brand new project and added the controls/etc....But after replicating exactly your steps, the application starts >>up...

>>This may sound like a silly question but did you by any chance copy ANY code you had from the previous application into the new one?

Nope. When I add the imagelist to a new project it will run.

Once I add an image to the imagelist, THAT is when it crashes.
0
 
LVL 4

Author Comment

by:programmer1024
ID: 17055497
OK, it seems my problem is solved.

Once I saved the project after adding the images to the imagelist, it worked. Very strange. It seems one has to save after adding images to the imagelist? Or maybe only I do? Or everyone else has autosave on??

0
 
LVL 8

Expert Comment

by:Shakti109
ID: 17057503

That's very strange indeed, no saving is necessary for it to run without error for any of the developers here at work(10 or so responded).

The only thing I can think of, is are you using images that are on a network share (or buried somewhere behind a very very deep path)?

This shouldnt affect it, because if you can "see" the images to use them in the first place, you both have access to them and they are available, BUT, odd things do happen occasionally.
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 17105679
Closed, 125 points refunded.
Netminder
Site Admin
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Introduction to Processes

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question