2
Reply

How to change an image in a label during runtime

syncan

syncan

Nov 16 2010 6:29 AM
4.9k
I try to make a simple program where I have an image in a label.
The name of the label is just label1.
The name of the old image is dob1.png and is initially placed in label1.image property using the Form.cs designer.

Now I want to replace dob1.png by the new dob2.png at runtime when you click on a button.

I know that I must put the code in the button-click event, but I dont know what the code should be.
What I think is that it should start with something like

this.label1.image .......

but what comes next? I cannot find it in the help of Visual-C# Express.

Can somebody help me out?


Answers (2)