Click here to Skip to main content
14,268,557 members
Rate this:
Please Sign up or sign in to vote.
See more:
What is the code for displaying pictures one at a time at a vb.net. when u click different buttons to display different pictures but only one get to display and the other are not visible

What I have tried:

I used a code only to show it but I dont want the rest to be displayed only just the required button picture to display
Posted
Updated 14-Aug-19 6:30am
Comments
ZurdoDev 14-Aug-19 11:29am
   
There are a million ways to write the code; however, none of them will work with your code because we don't know what you have named anything.

A better idea is to post the code you have and show us where you are stuck.
Lasagnia 14-Aug-19 11:41am
   
Okay the code is very simple
Picflag.visible = false
Picflag.show()
It can display but I only want one picture at a time to be displayed
ZurdoDev 14-Aug-19 11:45am
   
So, what is your question then?
Lasagnia 14-Aug-19 11:52am
   
When u click the button the flag picture displays ....lets say there are 5 different buttons and 5 different pictures when u click the first button a flag appears same as all of them but in different picture boxes not on the same one
ZurdoDev 14-Aug-19 11:59am
   
I still do not understand what you are asking us.
Lasagnia 14-Aug-19 12:06pm
   
Okay first relax think easy..
Code is what I am asking for
A code for displaying images any code that would allow me to display a picture in a picturebox when running the program and clicking a button
ZurdoDev 14-Aug-19 13:29pm
   
Then just google examples.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

You can load a picture from file like this:
PictureBox1.Image = Image.FromFile(“Flag1.jpg")
When another button is pressed, you can load another picture:
PictureBox1.Image = Image.FromFile(“Flag2.jpg")

An alternative is to use drawing commands, see examples here: VB:Flags Tutorial - Progzoo[^]
   
v2
Comments
Lasagnia 14-Aug-19 12:33pm
   
Thanks alot its great ✌😊😊

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100