473,395 Members | 1,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

ImageList Images Disappearing

Hi,

I have a ImageList containing 4 bitmaps attached to a UserControl
which acts as a Open/Close panel.

This panel, upon click, switches the image in a PictureBox control to
indicate the current panel status (Open/Close).

Problem is that in certain complex scenarios the images disappear!
from the ImageList. That is, when I call: imageList.Images[1], I get
the exception: Specified argument was out of the range of valid
values.
Parameter name: '1' is not a valid value for 'index'. And when I check
the length of the Images collection it turns out to be zero :-(

I have a faint clue regarding the cause of this problem - it may have
something to do with the visibility of the UserControl containing the
ImageList.

Has anyone seen something like that before?
Nov 16 '05 #1
2 3134
Solomon,

I am not quite sure, why ur imagelist behaves that way.

For time being you can do this,

try
{
//lets say you are trying to get a image here and for some reason
//it throws an execption
Image test = imageList.Images[1];
}
catch(Exception e)
{
//when the exception is thrown, reload the imagelist from resource.
this.imageList1.ImageStream =
((System.Windows.Forms.ImageListStreamer)(resource s.GetObject("imageList1.Im
ageStream")));

}

--
Shak
(Houston)


"A. Solomon" <ar***@nice.com> wrote in message
news:b4************************@posting.google.com ...
Hi,

I have a ImageList containing 4 bitmaps attached to a UserControl
which acts as a Open/Close panel.

This panel, upon click, switches the image in a PictureBox control to
indicate the current panel status (Open/Close).

Problem is that in certain complex scenarios the images disappear!
from the ImageList. That is, when I call: imageList.Images[1], I get
the exception: Specified argument was out of the range of valid
values.
Parameter name: '1' is not a valid value for 'index'. And when I check
the length of the Images collection it turns out to be zero :-(

I have a faint clue regarding the cause of this problem - it may have
something to do with the visibility of the UserControl containing the
ImageList.

Has anyone seen something like that before?

Nov 16 '05 #2
The images are populated into the imagelist during the initialization... if
you run any functions in the constructor before the imagelist has had a
chance to populate, then you may see this error.

I can't think of any other reason why you'd see this error at present...

--
John Wood
EMail: first name, dot, second name at priorganize.com
"A. Solomon" <ar***@nice.com> wrote in message
news:b4************************@posting.google.com ...
Hi,

I have a ImageList containing 4 bitmaps attached to a UserControl
which acts as a Open/Close panel.

This panel, upon click, switches the image in a PictureBox control to
indicate the current panel status (Open/Close).

Problem is that in certain complex scenarios the images disappear!
from the ImageList. That is, when I call: imageList.Images[1], I get
the exception: Specified argument was out of the range of valid
values.
Parameter name: '1' is not a valid value for 'index'. And when I check
the length of the Images collection it turns out to be zero :-(

I have a faint clue regarding the cause of this problem - it may have
something to do with the visibility of the UserControl containing the
ImageList.

Has anyone seen something like that before?

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: MB | last post by:
Hi a guys 02 questions a bout imageList please help me if you have an idea 1) I have a strange probleme with imageList, I added some images at designtime and I can see the images but at...
2
by: Michael C | last post by:
One more quick question. I am creating a form that uses an ImageList control. I originally wanted to use a PictureBox control to display the images in the ImageList, but it doesn't seem possible....
2
by: Sanjeeva Reddy | last post by:
hai Anti Keskinen, i have used the following code MyListView->LargeImageList->ImageSize = gcnew System::Drawing::Size(100, 100); // Sets large image size to 100, 100 here i am getting error...
7
by: Andrew Christiansen | last post by:
Hey everyone. I have Visual Basic .NET 2003 and am trying to show images on a treeview control. I have the imagelist on the form filled with images, and have the ImageList property of the...
4
by: David | last post by:
I have a problem that just cropped up with using an ImageList in my project I am using VB .NET 200 Problem: I have existing Form with 2 Image List controls. ImageList16 (for 16x16 Images) and...
4
by: Just Me | last post by:
If I add an image to an imagelist using imageList.Images.Add... And use it with a tree node tn.ImageIndex = imageList.Images.Count-1 This is the actual code:...
0
by: Andre Viens | last post by:
Hello, I am using the following variation of code from <http://support.microsoft.com/default.aspx?scid=kb;EN-US;319340> to add icons to an imagelist for use in a listview: Private Structure...
2
by: senfo | last post by:
I'm using a ListView control to display pictures similarly to how Windows Explorer displays pictures in "Thumbnails" view. The images are stored in an ImageList component. I would like to provide...
2
by: =?Utf-8?B?S2VuTg==?= | last post by:
We're using a System.Windows.Forms.ImageList to store a bunch of Images that I've loaded, and rendering each image in the ImageList during a draw loop. The process was running unusually slow and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.