Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X
This is the forum to discuss the Wrox book Professional Web Parts and Custom Controls with ASP.NET 2.0 by Peter Vogel; ISBN: 9780764578601
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 11th, 2006, 11:08 PM
Authorized User
Join Date: Jan 2006
Location: , , Canada.
Posts: 13
Thanks: 6
Thanked 1 Time in 1 Post
Default MyBase.CreateChildControls


On page 72 you said we can enable design time support and avoid the CreateChildControls method to be called twice if we set Me.ChildControlsCreated = True. I understand this part, but why would you need to call


immediately above

Me.ChildControlsCreated = True



  #2 (permalink)  
Old January 15th, 2006, 06:26 PM
Authorized User
Join Date: Dec 2005
Location: Goderich, Ontario, Canada.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts

That's a very good question since MyBase.CreateChildControls is going to set ChildControlsCreated anyway.

It's a good practice to always call the base method to make sure that any necessary work that the base method carries out is done. In this case, for instance, calling the base method would take care of setting ChildControlsCreated.

I should have put in one line or the other but not both. Since the sample was intended to show how to use ChildControlsCreated, I should have omitted the call to the base method. While calling the base method does no harm here, it also does no good.

In fact, throughout the book, I typically omit the call to the base method in order to focus attention on the code technique that I'm demonstrating. That would have been an excellent choice here.

When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.

- Sherlock Holmes, as recorded by Sir A. C. Doyle in "The Blanched Soldier"

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Composite's CreateChildControls called twice bmains .NET Framework 2.0 0 July 27th, 2005 10:53 AM
MyBase Keyword Little Shell VB.NET 2002/2003 Basics 2 May 2nd, 2005 05:18 PM

All times are GMT -4. The time now is 07:21 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.