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.Ad
d("", 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.