private void Button1_Click(object sender, EventArgs e) { textBox1.BringToFront(); }
private void Button2_Click(object sender, EventArgs e) { textBox1.Parent = panel1; textBox1.BringToFront(); }In this example, we have a form with a panel and a textbox control. When the button is clicked, the textbox control will be attached to the panel and brought to the front of the z-order. The package library used in these examples is System.Windows.Forms.