Adding Controls To Form Through Code

StreaksAthlete

New member
Joined
Aug 14, 2005
Messages
1
Programming Experience
1-3
i am using this code to add a picturebox to my form and perform a drag drop operation. But when i run the form, nothing shows up.
confused.gif

I need some help, PLEASE.


VB.NET:
[color=#00007f]Dim[/color] i as [color=#00007f]New[/color] Picturebox
[color=#00007f]Me[/color].Controls.[color=#00007f]Add[/color](i)
i.Visible = [color=#00007f]True[/color]
i.Image = imgFloor.Image[color=#007f00]'Another Picture on my form"
[/color]i.Left = 10
i.Top = 10
 
Try adding Me.SuspendLayout before adding the new control, and Me.ResumeLayout after you are are done.

Tg
 
I'd suggest setting all the properties first, then adding the control to the form. Have you checked what the Height and Width of the new PictureBox are? They may well be zero by default.
 
Back
Top