How do I add a picture in a picturebox in code?
I am trying to make like a little flag guesser and I want the picture to change each time I answer or open the program. How can I do this? My images are now in the debug file.
3 Replies
The picturebox has an
Image
property
Just set that to the desired image, and it should updateYeah but I want it to change during the program right. When you answer with the country name of the flag. I want it to change to another one using a randomiser.
I understand that. Doesnt change how you change the picture 🙂
You can set that property via code.
as a very short example...
so when the form loads, we pre-load all the images, and set a random image. when the button is clicked, we also set a random image