to copy a groupbox to another form.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JuniorDevelopment
    New Member
    • Jan 2010
    • 2

    to copy a groupbox to another form.

    Hello i have a Form which contains a groupbox with several labels.
    After a click a new form opens with a groupbox as parameter..
    But when i close that form the groupbox on original form has disapeared.

    It happens at Controls.Add(De tail).. apperently its not the right way or any help would be appreciated.

    code:

    private void lnklblToeslagen _LinkClicked(ob ject sender, LinkLabelLinkCl ickedEventArgs e)
    {

    GroupBox gb = gbToeslag;
    DetailForm df = new DetailForm(gb);
    df.Show();
    }

    public partial class DetailForm : Form
    {
    public DetailForm(Grou pBox Detail)
    {
    InitializeCompo nent();
    Detail.Controls .Add(Detail);
    Detail.Location = new Point(20, 30);
    this.Size = Detail.Size;
    this.Width +=40;
    this.Height += 60;
    }
  • NitinSawant
    Contributor
    • Oct 2007
    • 271

    #2
    you need to pass a copy of the groupbox object i.e. create new groupbox having same properties.

    chk out:



    Regards,
    Nitin Sawant

    Comment

    • JuniorDevelopment
      New Member
      • Jan 2010
      • 2

      #3
      Thanks NitinSawant, but I get an exception on serialize.
      It keeps telling me its not marked as serialize.
      I checked internet but whatever i tried i still got the exception.

      Greets,
      Jasper

      Comment

      Working...