The resource name is not stored in the PictureBox
A way is to use the Tag property, that you set with the name of the resource when you assign the image to the PictureBox
Then you will be able to test pictureBoxDED3.Tag
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hay i have a many picture boxes in a form. and i want to change one picture box image on bases of other picture box image.
For example using if statement, I want to change picturebox1 image[picture1] when picturebox2 image[picture5].
if (pictureBoxDED3.Image == SCADA.Properties.Resources.Breaker_Open)
{
pictureBoxSectionD3.Image = SCADA.Properties.Resources.Dead_voltage_section;
}
this doest show error but nor works.
please help me solve it. i am a beginner.
thanks
The resource name is not stored in the PictureBox
A way is to use the Tag property, that you set with the name of the resource when you assign the image to the PictureBox
Then you will be able to test pictureBoxDED3.Tag
I think that it will work if you define some members (maybe static) like this:
static readonly Image Breaker_Open = SCADA.Properties.Resources.Breaker_Open;
private void SomeFunction( )
{
if( pictureBoxDED3.Image == Breaker_Open )
{
. . .