Check an alternative too. If Tag is not yet used for other purposes, then try something like this:
Image test = Resources.Favorit;
for(int i = 0; i < lstPictureBox.Count(); i++)
{
> if( (string)lstPictureBox[i].Tag == “Favorit”)
> {
> lstPictureBox[i].Image = Resources.FavoritVit;
> lstPictureBox[i].Tag == “FavoritVit”;
> }
}
PictureBox oPictureBox = (PictureBox)sender;
oPictureBox.Image = Resources.Favorit;
oPictureBox.Tag = “Favorit”;
But, maybe the next code works too:
for(int i = 0; i < lstPictureBox.Count(); i++)
{
> lstPictureBox[i].Image = Resources.FavoritVit;
}
PictureBox oPictureBox = (PictureBox)sender;
oPictureBox.Image = Resources.Favorit;