Windows Forms ImageList ArgumentOutOfRangeException: InvalidArgument=Value of '1' is not valid for 'index'.
-
2012年4月13日 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
全部回复
-
2012年4月13日 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 2012年4月24日 6:10
-
2012年4月13日 7:12
Not yet, I'am not personally responsible for the deployment, so I'am waiting for response from my colleagues.
Jiri
-
2012年4月13日 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
-
2012年4月13日 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
- 已编辑 jirpun 2012年4月13日 12:43
-
2012年4月16日 5:40
HI,
Your imageslist is filled at design time / runtime?
-
2012年4月16日 7:23
HI,
Your imageslist is filled at design time / runtime?
At design time.
-
2012年4月17日 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.


