If you're tired of using third-party photo albums and you want to create your own, then dynamically creating picture boxes in your VB application is the way to go. In VB or Visual Basic, you can use the "PictureBox" constructor to initialise a new instance of the "PictureBox" class. Make your application dynamic by not having to predefine the amount of pictures the user can load. Give users the option to choose their images and create only the amount of picture controls needed.
- Skill level:
Other People Are Reading
Launch Microsoft Visual Basic Express, click "New Project..." on the left pane of your screen and double-click "Windows Forms Application" to start a new project.
Double-click the form to create a new form load event and add the following code to create a new picture box variable:
Dim picBox As New PictureBox
Define the path for the image you want to show using the new picture box.
picBox.Image = Image.FromFile("C:\Photos\image.jpg")
Apply some settings to your picture box control by adding the following code:
picBox.Visible = True picBox.Top = 20 picBox.Width = 1600 picBox.Height = 1200 picBox.Left = 10
Add the picture box control to your form.
Press "F5" to run your program and display the new picture box control with your picture.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for