alfer69 Posted August 29, 2003 Posted August 29, 2003 i have a form with 10 pictureboxes on it. i can't seem to figure out how to load pictures into them without hard coding everything. any hints? Quote
*Experts* mutant Posted August 30, 2003 *Experts* Posted August 30, 2003 Can you tell something more about what you are hardcoding? To load a picture into a picturebox you can do this: PictureBox1.Image = Image.FromFile("path to the file") Quote
alfer69 Posted August 30, 2003 Author Posted August 30, 2003 PictureBox1.Image = picimage(1) PictureBox2.Image = picimage(2) PictureBox3.Image = picimage(3) PictureBox4.Image = picimage(4) if i could make an array of the pictureboxes i could loop it easy enough Quote
*Experts* mutant Posted August 30, 2003 *Experts* Posted August 30, 2003 You can make an array of pictureboxes in code, but not in the designer. Quote
alfer69 Posted August 30, 2003 Author Posted August 30, 2003 i can make the array of pictureboxes in the code i can put the pics in them but my question is how do i get them to show without hard coding the the names of the pictureboxes on the form? Quote
LOFRANK Posted September 1, 2003 Posted September 1, 2003 You mean a sort of refresh that you need after the pic is loaded in the picturebox? really strange what you are saying, in .net you can't have this kind of problems, i suggest you to have a list of Names of the pictures, and to load it in the form controls by the simple functions that the controls give you Quote live any day of your life like your last.
LOFRANK Posted September 1, 2003 Posted September 1, 2003 If you have an array of pictureboxes, and you want to show it on a form having almost for example Picturebox1 control , Picturebox1=pictureArray(1) the game is done. Quote live any day of your life like your last.
*Experts* Volte Posted September 1, 2003 *Experts* Posted September 1, 2003 Use Me.Controls.Add() to add a control to the form. Something like this:'once you've set up all the PictureBoxes Dim p As New PictureBox() For Each p in pictureBoxArray Me.Controls.Add(p) Next p Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.