Rise! (those controls) - vb.net 2003
-
I had the idea to copy the controls of a panel to a new Form. It works if I use the copyTo method of the control collection of the panel. The problem is, the controls aren't copied, there moved!? :confused: Is this a bug or ...? Anyone an idea? Test it yourself. On a simple Windows Form with a panel1, a button1 and a textbox1: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' rise! Dim form2 As New Form Dim c(Panel1.Controls.Count - 1) As Control Panel1.Controls.CopyTo(c, 0) form2.Controls.AddRange(c) form2.Size = Panel1.Size form2.Show() End Sub As you will see, the controls are moved to the new form2, instead of copied there.
-
I had the idea to copy the controls of a panel to a new Form. It works if I use the copyTo method of the control collection of the panel. The problem is, the controls aren't copied, there moved!? :confused: Is this a bug or ...? Anyone an idea? Test it yourself. On a simple Windows Form with a panel1, a button1 and a textbox1: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' rise! Dim form2 As New Form Dim c(Panel1.Controls.Count - 1) As Control Panel1.Controls.CopyTo(c, 0) form2.Controls.AddRange(c) form2.Size = Panel1.Size form2.Show() End Sub As you will see, the controls are moved to the new form2, instead of copied there.