1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need help about switching betwean two pictures..

Discussion in 'Visual Basic ( VB )' started by cabron, Nov 8, 2010.

  1. cabron

    cabron New Member

    Joined:
    Nov 8, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Hi
    can anybody please tell me how to put two pictureboxes in a form...one on top of the other with allowing the user to switch betwean the pictures when he clicks on one of them....like if the user clicks on one picture, it should be on top of the other...plz sombody help me ASAP :embarasse
     
  2. virxen

    virxen New Member

    Joined:
    Nov 24, 2009
    Messages:
    387
    Likes Received:
    90
    Trophy Points:
    0
    try having 2 picture boxes with the same dimensions and same position on the form

    and write this code

    Code:
    Private Sub Picture2_Click()
    Picture2.Visible = False
    Picture1.Visible = True
    End Sub
    Private Sub Picture1_Click()
    Picture1.Visible = False
    Picture2.Visible = True
    End Sub
    

    but if you mean in different dimensions or position try this instead
    Code:
    Private Sub Picture2_Click()
    Picture1.ZOrder 1
    Picture2.ZOrder 0
    End Sub
    Private Sub Picture1_Click()
    Picture2.ZOrder 1
    Picture1.ZOrder 0
    End Sub
    
     
    Last edited: Nov 9, 2010
    shabbir likes this.
  3. cabron

    cabron New Member

    Joined:
    Nov 8, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    thaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanks alooot :D.......im getting the 3 bonus marks for my midterm tommorow..ur the best :2thumbsup
     

Share This Page