Groups | Blog | Home
all groups > vb.net > february 2004 >

vb.net : dynamically add controls


Snuyt
2/4/2004 7:02:49 PM
Hello,


I want to add some PictureBoxes to a panel in my form. Therefore, I use:

Dim p As New PictureBox()
p.Image = New Bitmap("pic.bmp")
p.SetBounds(10, 10, 50, 50)
Panel.Controls.Add(p)


This works quite well, except for this thing : the pictureboxes that are
added, appear below each other. So, if I first add A, then B, B appears
below A. Can anyone tell me what to set to let B appear above A ? I've
tried A.bringToFront(), but that doesn't work.

thx
Snuyt
Dominique Vandensteen
2/4/2004 8:13:35 PM
just delete the previous image...
Panel.Controls.Clear()
Panel.Controls.Remove()
Panel.Controls.RemoveAt()


[quoted text, click to view]

hirf-spam-me-here NO[at]SPAM gmx.at
2/4/2004 10:09:44 PM
* Snuyt <snuyt_nospam@skynet.be> scripsit:
[quoted text, click to view]

You will have to call 'B.BringToFront'.

--
Herfried K. Wagner [MVP]
AddThis Social Bookmark Button