Kritz
Kritz

Reputation: 7331

Changing the layout order of vb.net controls

I dynamically add picture boxes to a vb.net form. However, when I add the new picture box, it is always under/below/behind the picture boxes that I previously created. Is it possible to change it so that the newly created picture box would always be in front of the others?

Thanks

Upvotes: 0

Views: 1605

Answers (2)

Rudrik
Rudrik

Reputation: 832

Dim mypic As PictureBox = New PictureBox
mypic.Height = 13
mypic.Width = 13
mypic.Left = 100
mypic.Top = 100
mypic.Visible = True
mypic.SizeMode = PictureBoxSizeMode.Normal
mypic.Parent = Me
mypic.Image = Image.FromFile("Path of the Image")
Me.Controls.Add(mypic)
mypic.bringtofront()

Upvotes: 0

Alex Essilfie
Alex Essilfie

Reputation: 12613

Just add this code to the part that creates the pictureboxes

PictureBox.BringToFront()

Upvotes: 1

Related Questions