J
jcrouse
I want to add controls (labels) at runtime to a different form. Here is the
code that is being is under a button on form2:
Dim frm1 As New Form1
Dim MyLabel As New Label
MyLabel.BackColor = BackColor.Black
MyLabel.ForeColor = ForeColor.White
MyLabel.Text = intTopCounter.ToString
MyLabel.TextAlign = ContentAlignment.MiddleCenter
MyLabel.Top = intTopCounter
MyLabel.ContextMenu = frm1.cmnuLabels
MyLabel.Left = 40
MyLabel.Visible = True
intTopCounter = intTopCounter + 30
frm1.Controls.Add(MyLabel)
However, the labels never show up. What am I missing here.
Thanks,
John
code that is being is under a button on form2:
Dim frm1 As New Form1
Dim MyLabel As New Label
MyLabel.BackColor = BackColor.Black
MyLabel.ForeColor = ForeColor.White
MyLabel.Text = intTopCounter.ToString
MyLabel.TextAlign = ContentAlignment.MiddleCenter
MyLabel.Top = intTopCounter
MyLabel.ContextMenu = frm1.cmnuLabels
MyLabel.Left = 40
MyLabel.Visible = True
intTopCounter = intTopCounter + 30
frm1.Controls.Add(MyLabel)
However, the labels never show up. What am I missing here.
Thanks,
John