none
this.Controls.Clear() -- does it delete objects created with 'new' on the form? RRS feed

  • Question

  • I'm brand new to C#.

    In particular I'm populating a form with labels like so in a timer_tick function

    this.Controls.Clear ()

    for(i = 0; i < 10; ++i)

    {

    _arr[i,j] = new Label()

    groupBox1.Controls.add(_arr[i,j]);

    _arr[i,j].Text = "A";

    }

    this.Controls.Add(groupBox1);

    }

    so i keep regenerating  the labels with the loop using 'new'.

    Is the Controls.Clear() deleting the labels? I ask because every so often my windows form blinks and then reappears. The purpose is to populate the labels randomly with letters and most of the time the form is just there and the letters move around, but then it suddenly hiccups and reappears.

    Thank you for your input,

    s_b1

    • Moved by CoolDadTx Monday, January 23, 2012 12:30 AM Winforms related (From:Visual C# General)
    Sunday, January 22, 2012 8:52 PM

Answers