Results 1 to 5 of 5

Thread: Question about the InitializeComponents method

  1. #1
    beginner91 is offline C# Forum Newbie
    .NET Framework
    .NET 1.1
    Join Date
    Mar 2012
    Posts
    7
    Rep Power
    0

    Question about the InitializeComponents method

    This is a question on a past exam paper and I was wondering if someone could explain exactly what the question means?

    Discuss the role of the InitializeComponents method of the class Form derived classes in a C# WinForms application

    I know InitializeComponents adds the code to the program like for example when you add a button onto the form and a derived class is any class that inherits from any other derived class or base class.

    So is the question just asking me to discuss the InitializeComponents method of a derived class?


    I'm not asking anyone to answer the question for me, just please explain it in simple terms.

    thanks

  2. #2
    jmcilhinney is offline C# Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Apr 2011
    Posts
    713
    Rep Power
    61
    It's just asking you the purpose of the method, and that purpose is to create, configure and add all the controls and components that you add in the WinForms designer. We often talk about controls being added "in the designer" or added "in code" but, in actual fact, code is the only way to do anything. Any actions that you perform in the designer are translated into code by the designer and the InitializeComponent method is where most of the code goes.

  3. #3
    beginner91 is offline C# Forum Newbie
    .NET Framework
    .NET 1.1
    Join Date
    Mar 2012
    Posts
    7
    Rep Power
    0
    ok thanks but what does it mean from derived classes?
    I like a already said does the question just asking to discuss the InitializeComponents method of a derived class?

  4. #4
    jmcilhinney is offline C# Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Apr 2011
    Posts
    713
    Rep Power
    61
    I think that all they're referring to there is the fact that every time you add a new form to your project it is a new class derived from Form.

  5. #5
    beginner91 is offline C# Forum Newbie
    .NET Framework
    .NET 1.1
    Join Date
    Mar 2012
    Posts
    7
    Rep Power
    0
    I understand now. Thanks for the help

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking