C
Capital O
VS2005 RTM, CF 2.0, PocketPC 2003 SE
I created a base form class called MyBaseForm that inherits from Form.
I implement significant presentation helper functionality in this base
class. I can add an inherited form to my project (Form1), inherit from
MyBaseForm, and I get the designer, and all at first appears good. But
when I try to site my custom control (which inherits from TextBox) on
Form1, I get the following error:
Code generation for property 'HintStatusBar' failed. Error was:
'Object reference not set to an instance of an object.'
When I add my custom control to a regular form (inheriting directly
from System.Windows.Forms.Form), I don't have this problem, and my
control works fine.
I created a second, separate project, using a highly simplified base
form class, and reproduced the problem immediately. (I hoped for a
solution/project file corruption to explain it, but it wasn't in the
stars.)
HintStatusBar is a Control type which should be null, and the designer
shouldn't be trying to generate any code for this within
InitializeComponent. When I comment out HintStatusBar, I get the same
error message with other properties of type Control.
I've been reading the newsgroups and googling for this error message,
and have found it everywhere, but nowhere like what was happening to
me. I saw a recommendation to use a DesignerSerializationVisible
attribute to deflect the code generator away from it, but when I do a
search in VS2005's help I get basically nothing, and within
System.ComponentModel, I don't even see that attribute. Was this a
beta 2 feature that disappeared at RTM time?
To my further frustration, all of this was working with no problems
when I first set up the project, and only on day two, when I'm adding
another inherited form, has the problem arisen.
If I have to, I can inherit from Form, and when ready to compile,
change them all to MyBaseForm. But I've been waiting very patiently
for CF 2.0 and all the promises that this type of form inheritance
would work and work smoothly, and if there's a trick to avoiding such a
kludgey development process, I'd be indebted.
Any ideas?
I created a base form class called MyBaseForm that inherits from Form.
I implement significant presentation helper functionality in this base
class. I can add an inherited form to my project (Form1), inherit from
MyBaseForm, and I get the designer, and all at first appears good. But
when I try to site my custom control (which inherits from TextBox) on
Form1, I get the following error:
Code generation for property 'HintStatusBar' failed. Error was:
'Object reference not set to an instance of an object.'
When I add my custom control to a regular form (inheriting directly
from System.Windows.Forms.Form), I don't have this problem, and my
control works fine.
I created a second, separate project, using a highly simplified base
form class, and reproduced the problem immediately. (I hoped for a
solution/project file corruption to explain it, but it wasn't in the
stars.)
HintStatusBar is a Control type which should be null, and the designer
shouldn't be trying to generate any code for this within
InitializeComponent. When I comment out HintStatusBar, I get the same
error message with other properties of type Control.
I've been reading the newsgroups and googling for this error message,
and have found it everywhere, but nowhere like what was happening to
me. I saw a recommendation to use a DesignerSerializationVisible
attribute to deflect the code generator away from it, but when I do a
search in VS2005's help I get basically nothing, and within
System.ComponentModel, I don't even see that attribute. Was this a
beta 2 feature that disappeared at RTM time?
To my further frustration, all of this was working with no problems
when I first set up the project, and only on day two, when I'm adding
another inherited form, has the problem arisen.
If I have to, I can inherit from Form, and when ready to compile,
change them all to MyBaseForm. But I've been waiting very patiently
for CF 2.0 and all the promises that this type of form inheritance
would work and work smoothly, and if there's a trick to avoiding such a
kludgey development process, I'd be indebted.
Any ideas?