all groups > dotnet windows forms designtime > august 2005 >
You're in the

dotnet windows forms designtime

group:

Public enums not properly found in Forms Designer


Public enums not properly found in Forms Designer gwatts NO[at]SPAM phys.washington.edu
8/22/2005 11:31:14 AM
dotnet windows forms designtime: Hi,
I've been getting the " The variable 'MSDataType' is either
undeclared or was never assigned." error. Searching usnet it seems I'm
not the only one. The only difficulty is that no one ever replies. ;-)

A bit of background.

1) My solution has three projects in it. One contains user controls.
One of the user controls contains a public, designer, property that is
an enum type. That enum is also declared as a public property.

2) I've placed that control from project #1 on a form in project #2. I
then set and configure it in the designer. Including setting the enum
variable. It works just as you would expect.

2) The project builds just fine. And once built, runs just fine. In
short, I don't think I've forgotten to include references or not
labeled some enum as public.

3) Sometimes, after a rebuild, I'll get the above error. The
"MSDataType" is the enum type. The build environment then resets the
variable to the enum value that is represented by 0 (i.e. resets it to
the default).

4) Usually only the enum looses its configuration. But sometimes, if I
have a bad build error and the control library fails to build, and the
windows form is still open then I will looose all the settings (I have
about 30 components and controls on this form).

As you might imagine, this is a huge pain in the but -- the user
control is constantly loosing its configuration.

I am doing my best to determine a short sequence of actions that causes
this to happen, but haven't been able to come up with it. It always
takes me be (nasty) surprise.

Any help apprecitaed, and I can post the project as well (right now I
have to recover the 100+settings I lost when I was trying to reproduce
the error and accidentally erased everything -- even the positions of
my controls were lost!).

Cheers,
Gordon.

P.S. If you search for this error on msdn you'll end up with two KB
articles. Neither seems to apply to me. I've never built in release
mode and I've also don't have my app data directory redirected to
another zone.
Re: Public enums not properly found in Forms Designer Allen Anderson
8/24/2005 9:15:04 PM
I ran into this same problem with many of my controls. What it boils
down to is that enums declared inside a class are very problematic
when serializing through the designer. Move your enums outside the
class into the namespace instead. This fixed it for me and I was
having exactly the same problem you are having.

-Allen
http://www.glacialcomponents.com
http://allenanderson.blogspot.com


[quoted text, click to view]
Re: Public enums not properly found in Forms Designer gwatts NO[at]SPAM phys.washington.edu
8/25/2005 3:02:11 AM
Thanks! I've done it and been trying to make it break. I can't -- I
think you solved it for me!
Re: Public enums not properly found in Forms Designer Allen Anderson
8/25/2005 8:14:18 AM
Glad to hear it! If you only knew how many hours of my life were
wasted trying to track this problem down orignally for my controls. I
can't believe this problem isn't more well documented.

-Allen
http://www.glacialcomponents.com
http://allenanderson.blogspot.com


[quoted text, click to view]
AddThis Social Bookmark Button