P
Pieter
Hi,
I'm getting a really terrible and anoying bug/problem in VS.NET 2005:
1. Create a new Windows Application.
2. Add a new class Class1.
3. Add a usercontrol UserControl1.
4. Add a public instance of Class1 to UserControl1 (with WithEvents):
"Public WithEvents ThisClass As New Class1".
5. Build the Solution, and put an instance of UserControl1 on Form1.
6. Rebuild the Solution, and open the Form1 in the Designer (View Designer)
-> Everything works fine, you can close it and open it again in the designer
as much as you want...
7. Change anything to Form1 in the Designer: for instance make it just a
tiny bit larger. Save the changes, and close the Form1.
-> When you nowwant to open Form1 in the Designer, you get some nasty
exception:
*****************
One or more errors encountered while loading the designer. The errors are
listed below. Some errors can be fixed by rebuilding your project, while
others may require code changes.
The type 'WindowsApplication1.UserControl1' has no field named 'ThisClass'.
Hide Edit
at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager
manager, String exceptionText, String helpLink)
at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager
manager, CodeAssignStatement statement)
at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager
manager, CodeStatement statement)
****************
I noticed it added in the Form1.Designer.vb some lines in the
InitializeComponent():
"Dim Class11 As WindowsApplication1.Class1 = New WindowsApplication1.Class1"
and a little bit further "Me.UserControl11.ThisClass = Class11".
You can't open Form1 in the Designer if you don't remove the second line...
This behaviour doesn't happen if you declare the instance ThisClass as
Private, or without the WithEvents...
But I really would like to have it Public WithEvents. And I can't stand it
that I can't, hehe. Does anybody knows a solution for this? Is this a Bug?
Or is there a rule that a UserControl can't containt Public WithEvents
classes??
Any help, hints, or whatever would be really appreciated!
Thanks a lot in advance,
Pieter
I'm getting a really terrible and anoying bug/problem in VS.NET 2005:
1. Create a new Windows Application.
2. Add a new class Class1.
3. Add a usercontrol UserControl1.
4. Add a public instance of Class1 to UserControl1 (with WithEvents):
"Public WithEvents ThisClass As New Class1".
5. Build the Solution, and put an instance of UserControl1 on Form1.
6. Rebuild the Solution, and open the Form1 in the Designer (View Designer)
-> Everything works fine, you can close it and open it again in the designer
as much as you want...
7. Change anything to Form1 in the Designer: for instance make it just a
tiny bit larger. Save the changes, and close the Form1.
-> When you nowwant to open Form1 in the Designer, you get some nasty
exception:
*****************
One or more errors encountered while loading the designer. The errors are
listed below. Some errors can be fixed by rebuilding your project, while
others may require code changes.
The type 'WindowsApplication1.UserControl1' has no field named 'ThisClass'.
Hide Edit
at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager
manager, String exceptionText, String helpLink)
at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager
manager, CodeAssignStatement statement)
at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager
manager, CodeStatement statement)
****************
I noticed it added in the Form1.Designer.vb some lines in the
InitializeComponent():
"Dim Class11 As WindowsApplication1.Class1 = New WindowsApplication1.Class1"
and a little bit further "Me.UserControl11.ThisClass = Class11".
You can't open Form1 in the Designer if you don't remove the second line...
This behaviour doesn't happen if you declare the instance ThisClass as
Private, or without the WithEvents...
But I really would like to have it Public WithEvents. And I can't stand it
that I can't, hehe. Does anybody knows a solution for this? Is this a Bug?
Or is there a rule that a UserControl can't containt Public WithEvents
classes??
Any help, hints, or whatever would be really appreciated!
Thanks a lot in advance,
Pieter