Windows Develop Bookmark and Share   
 index > Windows Forms Designer > _MYFORMS=True What is this constant and why designer gets lost when not having it?
 

_MYFORMS=True What is this constant and why designer gets lost when not having it?


Hi,

After hours spent on this little thing which drove me crazy, cause I got other things to do other than chasing bugs in the designer, I found the following:

If you create a ClassLibrary in which you create a user control UC1.vb for example.
Now create a windows forms application and add 2 user controls FormsUC.vb which inherits from UC1 and another one FormsDerivedUC.vb which inherits from FormsUC. Compile and open FormsDerivedUC in the designer. Everything looks fine.

Now close all designers and go to the class library and rename UC1 to something else UC2 for Example. Recompile and reopen formsderivedUC again.
Bang!! Here I get
Could not load type 'ClassLibrary1.UC2' from assembly 'ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
FormsUC still woks though no complaint.

Now create a Windows Forms Control Library instead of Class Library and repeat the steps. Everythig works smoothly.

I did a diff between the class library and control library and the only difference is that for each configuration (Debug or Release) in the control library there is this line defined:
<DefineConstants>_MYFORMS=True</DefineConstants>

How does this affect things?
I can get my problem fixed by closing and reopening the solution but that's not what I want to do for the money I spent on the tool right? I'm using VS 2008 Professional.

Did anybody encounter this before?

Thanks,
Cosmin
koko  Monday, July 21, 2008 3:00 PM

Hi Koko

I have followed your step and create all the projects you mention in this situation but found no problem after I renamed the UC1 to UC2. So it is hard for me to recure.

As for the effects of the predefined values of _MYFORMS=True, it just enable My.Forms

You can refer to it on the MSDN:

http://msdn.microsoft.com/en-us/library/ms233781.aspx

Wish this post can give you help.

Best Regards,

Kira Qian

Windows Forms General FAQs
Windows Forms Data Controls and Databinding FAQs

Kira Qian  Thursday, July 24, 2008 6:42 AM

Hi,

I tried it on another machine and I couldn't reproduce it. The difference is that on my machine I have vs2008 Pro and the other machine is 2008 Team Suite.

Thanks,
Cosmin
koko  Thursday, July 24, 2008 11:15 AM

You can use google to search for other answers

Custom Search

More Threads

• EditorAttribute issue with Common Types
• DataSet-type property is serialized in resx file.
• Nasty drop down border of Combo
• I 'm having a problem with my User Control
• WinForms 2005 - "Ctrl" drag on a form design.
• default toolbox tab for usercontrol
• Error when delete a control binded to a datarow that was deleted
• Embedded control problem
• How to do parallel transactions in SQL server database using VB.Net 2005?
• Error loading string resource?