Windows Forms ImageList ArgumentOutOfRangeException: InvalidArgument=Value of '1' is not valid for 'index'.
-
13 апреля 2012 г. 6:48
Hi all,
I have a Windows Forms application, a form with an ImageList containing 8 images loaded at design time.
The ImageList is used in runtime in this way:
private int IMG_GREEN = 1; ... pictureBoxStatus.Image = imageList1.Images[IMG_GREEN]; ...
It works fine at most computers (hundreds), but it raises exception at only one.
Do you have any idea, where can be a problem?
Damaged the exe file?
Wrong assembly of .NET framework?
Virus?
Thanks
Jiri
Все ответы
-
13 апреля 2012 г. 7:01
hi,
did you try re-installing it?
if it is 1 in hundreds, it is not going to be a coding error.
Regards, Nico
- Помечено в качестве ответа Alan_chenModerator 24 апреля 2012 г. 6:10
-
13 апреля 2012 г. 7:12
Not yet, I'am not personally responsible for the deployment, so I'am waiting for response from my colleagues.
Jiri
-
13 апреля 2012 г. 7:17
Have you done the imageList1.Add("xxxxx") before the
pictureBoxStatus.Image = imageList1.Images[IMG_GREEN];
?List the full function here if you want.
chanmm
chanmm
-
13 апреля 2012 г. 12:42
Have you done the imageList1.Add("xxxxx") before the
pictureBoxStatus.Image = imageList1.Images[IMG_GREEN];
?
No, the imagelist is filled in design time with eight images.
Jiri
-
16 апреля 2012 г. 5:40
HI,
Your imageslist is filled at design time / runtime?
-
16 апреля 2012 г. 7:23
HI,
Your imageslist is filled at design time / runtime?
At design time.
-
17 апреля 2012 г. 3:02Модератор
Hi jirpun,
Any updates from your colleagues? The exception means the index 1 is outside the allowable range of images. Try @Nico's suggestion, reinstall it.
Have a nice day.
Alan Chen[MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.


