Reputation: 33
hi its a catalogue application I have 50 pictures on my folder but i want in the app load show 12 pictures in 12 picturebox i use this code but it gives me nothing
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim pic As PictureBox
For i = 0 To 12
pic = Me.Controls("picturebox" & i)
pic.Image = Image.FromFile("C:\Dev\Images\TEST400.jpg")
Next i
End Sub
Help plz
Upvotes: 0
Views: 308
Reputation: 10443
Your image files should be saved as TEST1.jpg,TEST2.jpg, ......TEST12.jpg etc.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim pic As PictureBox
For i = 1 To 12
pic = Me.Controls("picturebox" & i)
pic.Image = Image.FromFile(@"C:\Dev\Images\TEST" + i.ToString +".jpg")
Next i
End Sub
Note: I just wrote this code here only. Its not tested.
Upvotes: 1