For example;
panel1.Controls.Add(myControl);
add to end of the collection.
Is there a way to add to the beginning of the collection without replacing the one at the beginning?
panel1.Controls.AddAt(0, myControl)
replaces the control at 0.
update
actually it seems to work and not replace it. i might have gotten it wrong.
C# Control Windows Forms controls are reusable components that encapsulate user interface functionality and are used in client-side Windows applications. A button is a control, which is an interactive component that enables users to communicate with an application.
You can use ControlCollection.SetChildIndex
method.
Sets the index of the specified child control in the collection to the specified index value.
When
SetChildIndex
is called, theControl
referred to by the child parameter is moved to the position specified by newIndex and the otherControl
references in theControl.ControlCollection
are reordered to accommodate the move.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With