Discussion:
Designer deleting user controls with Visual Studio 2003 SP1
(too old to reply)
dcraig
2007-04-19 17:55:40 UTC
Permalink
I'm having a problem with user controls in the VS Designer. Recently I had
my machine upgraded and, of course, had to reinstall Visual Studio.
Specifically, I have many forms which host user controls which I have
extended from the base classes such as textboxes and datagrids. My problem
is that, while the project compiles fine, if I open the forms in the
designer it deletes all my user controls from the form and I get the error
message;

"Could not find type 'ClioShared.clsAddressLinesGrid'. Please make sure
that the assembly that contains this type is referenced. If this type is a
part of your development project, make sure that the project has been
successfully built." (Or the same with different user defined controls)

I have had this problem before with the old machine but always managed to
work around it by changing the declaration and instantiation to include the
dll name (or remove the dll name), but this no longer works. The dlls are
in the references for the project, and the form does import the dll. For
example the above 'ClioShared' dll has been added to the references for the
project and at the top of the form 'imports clioShared'.

There is a 'hotfix' (KB: 842706), but I was told by MS that it is included
in SP 1, which I already have. From reading the forums and googling around
I see that this is a common problem and it probably has multiple causes.
What I've tried so far;

Removing and then adding the references to the dll (ClioShared) to the
project containing the form.

Changing the reference in the declaration and instantiation to include the
dll name (eg: changing 'Dim ctbTextBoxName As new clsAddressLinesGrid' to
'Dim ctbTextBoxName As New clioShared.clsAddressLinesGrid' and the same for
the instantiation).

One possible complication is that I also have installed SQL Server
Management Studio 2005, although I don't see any reason for that to cause
problems.

Environment:
XP Pro SP Version 2002 SP 2
Visual Studio 2003 1.1.4322 SP 1
Visual Source Safe 6.0d
dcraig
2007-04-30 21:44:35 UTC
Permalink
I ended up calling Microsoft for help with this problem. Apparently it's a
known issue with the designer called 'The white screen of darn'.

The solution was to go into the project, remove all references from the
offending classes from all projects. Then, through Windows explorer, find
all the dlls from these classes and delete them from each project in the
solution. Save the project, rebuild the offending dll's, put all the
references back, and at that point you should be able to edit the form in
the designer without having it delete all your user defined controls. For
me, once it was working I could see the controls again and modify them
through the designer.

From what I've been able to understand the designer is looking at an earlier
version of the dll and not finding something in it, at which point it
decides it doesn't exist and deletes it for you. So deleting all the dlls
and references, saving, then rebuilding the dlls and replacing the
references gets everything back in synch. It's not that simple however, as
I did this successfully Friday and everything was good, but this morning I
had to do it again so there's something more going on here, but at least
it's a workaround.

I hope this save someone out there some time and frustration;

David Craig.
Post by dcraig
I'm having a problem with user controls in the VS Designer. Recently I
had my machine upgraded and, of course, had to reinstall Visual Studio.
Specifically, I have many forms which host user controls which I have
extended from the base classes such as textboxes and datagrids. My
problem is that, while the project compiles fine, if I open the forms in
the designer it deletes all my user controls from the form and I get the
error message;
"Could not find type 'ClioShared.clsAddressLinesGrid'. Please make sure
that the assembly that contains this type is referenced. If this type is
a part of your development project, make sure that the project has been
successfully built." (Or the same with different user defined controls)
I have had this problem before with the old machine but always managed to
work around it by changing the declaration and instantiation to include
the dll name (or remove the dll name), but this no longer works. The dlls
are in the references for the project, and the form does import the dll.
For example the above 'ClioShared' dll has been added to the references
for the project and at the top of the form 'imports clioShared'.
There is a 'hotfix' (KB: 842706), but I was told by MS that it is included
in SP 1, which I already have. From reading the forums and googling
around I see that this is a common problem and it probably has multiple
causes. What I've tried so far;
Removing and then adding the references to the dll (ClioShared) to the
project containing the form.
Changing the reference in the declaration and instantiation to include the
dll name (eg: changing 'Dim ctbTextBoxName As new clsAddressLinesGrid' to
'Dim ctbTextBoxName As New clioShared.clsAddressLinesGrid' and the same
for the instantiation).
One possible complication is that I also have installed SQL Server
Management Studio 2005, although I don't see any reason for that to cause
problems.
XP Pro SP Version 2002 SP 2
Visual Studio 2003 1.1.4322 SP 1
Visual Source Safe 6.0d
jokiz
2007-05-12 02:26:06 UTC
Permalink
i've developed controls with designer for a year with vs2003 and i
haven't encountered things like these. for container controls eating
child controls, it's usually a problem/bug with the designer code. sad
and tedious workaround for you.
Post by dcraig
I ended up calling Microsoft for help with this problem. Apparently it's a
known issue with the designer called 'The white screen of darn'.
The solution was to go into the project, remove all references from the
offending classes from all projects. Then, through Windows explorer, find
all the dlls from these classes and delete them from each project in the
solution. Save the project, rebuild the offending dll's, put all the
references back, and at that point you should be able to edit the form in
the designer without having it delete all your user defined controls. For
me, once it was working I could see the controls again and modify them
through the designer.
From what I've been able to understand the designer is looking at an earlier
version of the dll and not finding something in it, at which point it
decides it doesn't exist and deletes it for you. So deleting all the dlls
and references, saving, then rebuilding the dlls and replacing the
references gets everything back in synch. It's not that simple however, as
I did this successfully Friday and everything was good, but this morning I
had to do it again so there's something more going on here, but at least
it's a workaround.
I hope this save someone out there some time and frustration;
David Craig.
Post by dcraig
I'm having a problem with user controls in the VS Designer. Recently I
had my machine upgraded and, of course, had to reinstall Visual Studio.
Specifically, I have many forms which host user controls which I have
extended from the base classes such as textboxes and datagrids. My
problem is that, while the project compiles fine, if I open the forms in
the designer it deletes all my user controls from the form and I get the
error message;
"Could not find type 'ClioShared.clsAddressLinesGrid'. Please make sure
that the assembly that contains this type is referenced. If this type is
a part of your development project, make sure that the project has been
successfully built." (Or the same with different user defined controls)
I have had this problem before with the old machine but always managed to
work around it by changing the declaration and instantiation to include
the dll name (or remove the dll name), but this no longer works. The dlls
are in the references for the project, and the form does import the dll.
For example the above 'ClioShared' dll has been added to the references
for the project and at the top of the form 'imports clioShared'.
There is a 'hotfix' (KB: 842706), but I was told by MS that it is included
in SP 1, which I already have. From reading the forums and googling
around I see that this is a common problem and it probably has multiple
causes. What I've tried so far;
Removing and then adding the references to the dll (ClioShared) to the
project containing the form.
Changing the reference in the declaration and instantiation to include the
dll name (eg: changing 'Dim ctbTextBoxName As new clsAddressLinesGrid' to
'Dim ctbTextBoxName As New clioShared.clsAddressLinesGrid' and the same
for the instantiation).
One possible complication is that I also have installed SQL Server
Management Studio 2005, although I don't see any reason for that to cause
problems.
XP Pro SP Version 2002 SP 2
Visual Studio 2003 1.1.4322 SP 1
Visual Source Safe 6.0d
Loading...