winforms - Image property not found in runtime PictureBox control c# -


image property not found item variable. code -

foreach (control item in this.controls) //iterating controls on form {     if (item picturebox)     {         if (item.tag.tostring() == ipaddress + "onoff")         {             methodinvoker action = delegate             { item.image= }; //.image property not shown             item.begininvoke(action);             break;         }     } } 

any please?

your item variable still of type control. checking instance referencing picturebox not change that. change code to:

foreach (control item in this.controls) //iterating controls on form {     var pb = item picturebox; // can access picturebox, if 1     if (pb != null)     {         if (item.tag.tostring() == ipaddress + "onoff")         {             methodinvoker action = delegate             {                  pb.image =  ... // works             };              bp.begininvoke(action);             break;         }     } } 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -