Click here to Skip to main content
15,906,467 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hai , anyone can advice my how to correct my code.It seem dont have error but it only able to load 1 picture only.In my code here i am using combobox to load a image into Picturebox. I got 3 item in combo box and 3 image which need to load in picturebox.. Any suggestion?


VB
Private Sub CBpayment_SelectedIndexChanged(ByVal sender As ystem.Object, ByVal e As System.EventArgs) Handles CBpayment.SelectedIndexChanged
   PBOffice2.Image = My.Resources.dollar_us
   PBOffice2.Image = My.Resources.check_money
   PBOffice2.Image = My.Resources.pound
End Sub
Posted
Updated 5-Sep-11 7:37am
v2

1 solution

Your code would load each resource image sequentially in the PictureBox control. However, a picture box control can only display one image at a time. Each time you set the PictureBox.Image property, you're removing the previous image and replacing it with another.

If you need to display multiple images simultaneously, you could instead draw them on your form using Graphics.DrawImage, or you could create a custom control with multiple PictureBox controls. I would suggest simply drawing the images on the form.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900