Dynamic Picturebox help

klanda20

Member
Joined
Mar 22, 2006
Messages
9
Programming Experience
Beginner
Hi All,

I have an application that reads in pictures from a database. THe problem is there is not a set number of pictures that are gunna be read into the form. Therefore I need to somehow read in X number of pictures at one time. So I can't just have a static number of pictureboxs on the form.

Is there a way to dynamically create pictureboxs at runtime???

Thanks
 
Create a new object instance of type PictureBox, sets its properties and add it to the Controls collection of the container you wish, for example a form or a panel etc. Example, where 'Me' is reference to the current form (so the picbox is added directly to form..)
VB.NET:
Dim p As New PictureBox
p.Name = "mynewpicturebox1"
Me.Controls.Add(p)
 
Back
Top