Good Evening,
I'm creating a number of Picture Boxes dynamically in a Tab Control, however once the code runs only the last Picture Box is displayed?
Only the last Picture Box is displayed, when the above is run.Code:Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim NewTab As New TabPage Dim NewPic As New PictureBox Dim lngX As Long Dim lngY as Long NewTab.Name = "New Tab" & CStr(Count) NewTab.Text = NewTab.Name Count += 1 NewPic.Image = Image.FromFile("C:\My Pictures\Picture.jpg") NewPic.Size = New Size(200, 200) Me.TabControl1.Controls.Add(NewTab) lngX = 0 lngY = 0 For x = 1 To 2 NewPic.Location = New System.Drawing.Point(lngX, lngY) NewTab.Controls.Add(NewPic) lngX += 210 lngY += 0 Next Me.TabControl1.SelectedIndex = Me.TabControl1.TabCount - 1 End Sub
Any ideas as to why the first one isn't created/displayed?
Many Thanks & Regards




Reply With Quote
