What a difference a function call makes sometimes, right?
Ever start a program, go to a specific form and all the controls that were placed on the form at design time are missing? Well, some way some how, the InitializeComponent method has probably been removed from the form's constructor. The InitializeComponent method is a private void method which is placed inside the "Windows Form Designer generated code" region by Visual Studio. The attached comment even states that it is a "Required method for Designer support - do not modify the contents of this method with the code editor." This method sets all the properties of the form, initializes every control and subsequently adds each one to its parent control. Sometimes people think this is just magic that the controls get added to the form, but it's the InitializeComponent method which is doing all of the heavy lifting. So, if the controls are missing, check to verify that InitializeComponent is being called in the form's constructor.
Saturday, December 02, 2006
Quick Hitter: Blank Form
Posted by Ryan O'Neill at 10:30 AM
Labels: .NET Compact Framework, Quick Hitter, Visual Studio
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment