Adding Controls to a Panel

Private Sub CreateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateButton.Click

 

        Dim dynamicPanel As New Panel()

        dynamicPanel.Location = New System.Drawing.Point(26, 12)

        dynamicPanel.Name = "Panel1"

        dynamicPanel.Size = New System.Drawing.Size(228, 200)

        dynamicPanel.BackColor = Color.LightBlue

 

 

 

        Dim textBox1 As New TextBox()

        textBox1.Location = New Point(10, 10)

        textBox1.Text = "I am a TextBox5"

        textBox1.Size = New Size(200, 30)

 

        Dim checkBox1 As New CheckBox()

        checkBox1.Location = New Point(10, 50)

        checkBox1.Text = "Check Me"

        checkBox1.Size = New Size(200, 30)

 

        dynamicPanel.Controls.Add(textBox1)

        dynamicPanel.Controls.Add(checkBox1)       

 

        Controls.Add(dynamicPanel)

 

 

 

    End Sub

이 게시물을

공유하기

SEARCH

MENU NAVIGATION