Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
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.

1 solution

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[^]
 
Share this answer
 
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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900