Hi, So what I am looking to do is to add a label to a specific image. At the moment I have a gallery and I would like to add labels to it to display what the image is.
For example if Images(0) was shown, then the program would lbl.show() and lbl.hide() the other existing labels (I have three labels in total all in the same position)
I have tried doing these lines below but the program was saying that it cannot be converted to a bitmap.
and this code was vice versa for each image.
Current Code:
For example if Images(0) was shown, then the program would lbl.show() and lbl.hide() the other existing labels (I have three labels in total all in the same position)
I have tried doing these lines below but the program was saying that it cannot be converted to a bitmap.
Code:
If PodGalleryPictureBox.Image = Images(0) Then
lblLondon.show()
lblLiverpool.hide()
lblManchester.hide(0)
End If
If PodGalleryPictureBox.Image = Images(1) Then
lblLondon.hide()
lblLiverpool.show()
lblManchester.hide(0)
End If
Current Code:
Code:
Public Class PodsGallery
Dim Images(14) As Bitmap
Dim Pos As Integer = 0
Private Sub Pods_Gallery_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'Inserting images from resources
Images(0) = GloriousGetaways.My.Resources._1
Images(1) = GloriousGetaways.My.Resources._2
Images(2) = GloriousGetaways.My.Resources._3
Images(3) = GloriousGetaways.My.Resources._4
Images(4) = GloriousGetaways.My.Resources._5
Images(5) = GloriousGetaways.My.Resources._6
Images(6) = GloriousGetaways.My.Resources._7
Images(7) = GloriousGetaways.My.Resources._8
Images(8) = GloriousGetaways.My.Resources._9
Images(9) = GloriousGetaways.My.Resources._10
Images(10) = GloriousGetaways.My.Resources._11
Images(11) = GloriousGetaways.My.Resources._12
Images(12) = GloriousGetaways.My.Resources._13
Images(13) = GloriousGetaways.My.Resources._14
'Puts the images into order
PodGalleryPictureBox.Image = Images(Pos)
End Sub
'Opens Gallery Form
Private Sub btnBack_Click(sender As Object, e As EventArgs) Handles btnBack.Click
Gallery.Show()
Me.Hide()
End Sub
'Opens Book a Pod Form
Private Sub btnBookAPod_Click(sender As Object, e As EventArgs) Handles btnBookAPod.Click
BookAPod.Show()
Me.Hide()
End Sub
'Opens Main Meny Form
Private Sub btnMainMenu_Click(sender As Object, e As EventArgs) Handles btnMainMenu.Click
MainMenu.Show()
Me.Hide()
End Sub
'Directing the right button to show the next photo
Private Sub btnRight_Click(sender As Object, e As EventArgs) Handles btnRight.Click
Pos = Pos + 1
If Pos < Images.Length - 1 Then
PodGalleryPictureBox.Image = Images(Pos)
Else
Pos = Images.Length - 2
End If
End Sub
'Directing the left button to show the previous photo
Private Sub btnLeft_Click(sender As Object, e As EventArgs) Handles btnLeft.Click
Pos = Pos - 1
If Pos >= 0 Then
PodGalleryPictureBox.Image = Images(Pos)
Else
Pos = 0
End If
End Sub