ok - i have two images on the form if i click on ont of them it should dissapear and somewhere on a label to be displayed as 1 and if i click on the next image also to dissapear and the label to show 2 HELP..
Printable View
ok - i have two images on the form if i click on ont of them it should dissapear and somewhere on a label to be displayed as 1 and if i click on the next image also to dissapear and the label to show 2 HELP..
?
could u elaborate a bit ?
Assuming your images are called Picture1 and Picture2:
VB Code:
Private Sub Picture1_Click() Picture1.Visible = False Label.Caption = "1" 'make the other picture visible again (Don't know if neccesary) Picture2.Visible = True End Sub Private Sub Picture2_Click() Picture2.Visible = False Label.Caption = "2" 'make the other picture visible again (Don't know if neccesary) Picture1.Visible = True End Sub
but what if i have 50 (for example) pictures? The code would be huge. I need something like if another piture is hidden then label +1 ?
use control array and use the index value to display in label
Then you should call all the picture different. Like this:
Picture(0), Picture(1), Picture(x).
Private Sub Picture1_Click(Index As Integer)
Picture1(index).Visible = False
Label.Caption = index
'make the other picture visible again (Don't know if neccesary)
End Sub
if u want to make the rest picture visible u can loop....
Private Sub Picture1_Click(Index As Integer)
Picture1(index).Visible = False
Label.Caption = index
'make the other picture visible again (Don't know if neccesary)
End Sub
if u want to make the rest picture visible u can loop....
and set the visible =true