Hi, I'm facing a problem wherein the image in pictureBox1 does not appear with coding as shown below. The image in pictureBox2 was done manually wherein i added bitmap image in BackgroundImage properties.

When i coded pictureBox without panel, it worked but not on panel.

Public Class frmMain
Dim availableIcon As New System.Drawing.Bitmap(My.Resources.Available)
Dim provisionalIcon As New System.Drawing.Bitmap(My.Resources.Provisional)

Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
If CType(sender, PictureBox).Image Is availableIcon Then
CType(sender, PictureBox).Image = provisionalIcon
ElseIf CType(sender, PictureBox).Image Is provisionalIcon Then
CType(sender, PictureBox).Image = availableIcon

End If
End Sub

Private Sub pnlAuditorium1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles pnlAuditorium1.Click

Dim c As Control

For Each c In Me.Controls
If TypeOf (c) Is PictureBox Then
CType(c, PictureBox).Image = availableIcon
AddHandler c.Click, AddressOf PictureBox1_Click
End If


End Sub

Name:  Capture1.PNG
Views: 70
Size:  1.5 KB