Exvayate Posted November 28, 2011 Author Share Posted November 28, 2011 Is there a way or command in vb6 that will allow me to make a button to allow a picture to appear and then click it again for it to dissapear?Here's what I've gotten to make the button show the picture:```Private Sub Command1_Click() If Picture1.Visible = False Then Picture1.Visible = True End IfEnd Sub```What is the code to make it so if I click it again it will hide the picture? Link to comment Share on other sites More sharing options...
Sealbreaker Posted November 28, 2011 Share Posted November 28, 2011 ```Private Sub Command1_Click() If Picture1.Visible = False Then Picture1.Visible = True Else Picture1.Visible = False End IfEnd Sub```-seal Link to comment Share on other sites More sharing options...
Domino_ Posted November 28, 2011 Share Posted November 28, 2011 Also…```Private Sub Command1_Click() If Picture1.Visible = True Then Picture1.Visible = False ElseIf Picture1.Visible = False Then Picture1.Visible = True End IfEnd Sub``` Link to comment Share on other sites More sharing options...
Scott Posted November 28, 2011 Share Posted November 28, 2011 Considering it could only be true or false there is no need for the elseif… Link to comment Share on other sites More sharing options...
Carim123 Posted November 28, 2011 Share Posted November 28, 2011 Even better:```Picture.visible = Not Picture.visible```Also, guys above, learn to nest, please. Link to comment Share on other sites More sharing options...
Exvayate Posted November 28, 2011 Author Share Posted November 28, 2011 Ahh thanks haha. I'me still learning the syntax and commands in vb6\. Thanks for the help guys, MUCH appreciated! :] Link to comment Share on other sites More sharing options...
mrmiguu Posted November 28, 2011 Share Posted November 28, 2011 **@Exvayate** I suggest considering Serenade's code. It is condensed enough for visibility reasons and works well dynamically.If ever possible, try to avoid the psuedo-typical _If…Then_ block. Code can look much nicer otherwise.tl;dr: **Nesting**. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now