Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Design Time / August 2005

Tip: Looking for answers? Try searching our database.

Public enums not properly found in Forms Designer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gwatts@phys.washington.edu - 22 Aug 2005 19:31 GMT
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.
Allen Anderson - 25 Aug 2005 04:15 GMT
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

>Hi,
>  I've been getting the " The variable 'MSDataType' is either
[quoted text clipped - 44 lines]
>mode and I've also don't have my app data directory redirected to
>another zone.
gwatts@phys.washington.edu - 25 Aug 2005 11:02 GMT
Thanks! I've done it and been trying to make it break. I can't -- I
think you solved it for me!
Allen Anderson - 25 Aug 2005 15:14 GMT
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

>Thanks! I've done it and been trying to make it break. I can't -- I
>think you solved it for me!

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.