|
-
Jun 28th, 2009, 07:05 PM
#7
Re: Stupid Questions, I Know... But I'm Stumped
Are you using the default instance of the form? If you aren't sure what a default instance is, here's a brief, and possibly poor, explanation:
When you create a form, you can give it a name, such as MyForm. That is actually the name of a class derived from Form with the name MyForm. However, beginning with 2005, .NET began adding default instances, which means that, while MyForm is the name of the class, .NET is also, quietly, making a global instance of type MyForm with the name MyForm. This creates havoc for people who are not familiar with it, because every other object has to be instantiated before it is used....except for forms. If you are using a default instance, it has to exist as soon as the program starts, so the constructor is called before the program actually starts. If you are doing something like this:
Dim nf As New MyForm
and you are working with nf, then the constructor WILL be called. After all, that InitializeComponent call is kind of vital. Without that, you won't have any controls on your form. However, if you are using the default instance, well, I believe you will get the behavior you are seeing.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|