Skip to content

Purpose of this code

Asked Apr 13, 2007, 10:15 AM EDT2 answers
Share
LinkedInX

Hi Guys

 

Please any one can explain the purpose of this code.

 

this.Controls.AddRange(new System.Windows.Forms.Control[] {this.button1});

 

This code is not there when we create a Visual Studio IDE to design a Form.

 

Thank you

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    CSS
    
    Hi,
    
    It adds a list of controls, containing only one control, to the "this" object which is probably your form.  So in other words it adds button1 to the current form.
    
    Simon
    0
  • 1 short reply
    • 0
      Thank you for your help.
      0