Click to See Complete Forum and Search --> : control creation in code?


makai
November 28th, 2002, 01:23 PM
how do you add a control in code - I have tried this with no luck:

Dim c As System.Windows.Forms.Button
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load

c = New System.Windows.Forms.Button()
c.Enabled = True
c.Visible = True
c.Text = "One"
c.Height = 20
c.Width = 200
c.Top = 0
c.Left = 0
End Sub

Athley
November 28th, 2002, 02:55 PM
One additional row....

Me.Controls.Add(c)

/Leyan