Hi.
I want to create a picturebox when a specific button is clicked. The code below displays nothing :(

TC has an initial value of 0. It will count he number of times the picturebox has been created.

Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
        TC = TC + 1
        Dim TCP As New Integer
        TCP = TC * 100
        Dim NT As New PictureBox
        NT.Anchor = AnchorStyles.Top And AnchorStyles.Left
        NT.BackColor = Color.Transparent
        NT.Enabled = True
        NT.Image = My.Resources.Tab01
        NT.Location = New Point(TCP, 85)
        NT.Size = New Size(100, 30)
        NT.SizeMode = PictureBoxSizeMode.StretchImage
        NT.Visible = True
End Sub

Hi,

Add this:

'add control to form
Controls.Add(NT)

Thanks it worked

Hi,

No problem glad to help!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.