
Signature
HTH
Stoitcho Goutsev (100)
>I am running VS.NET 2005. I have created a UserControl and added it to
> my toolbox. When I try to drag it onto a Form, Visual Studio closes
[quoted text clipped - 7 lines]
>
> Joel
Actually, I solved the problem last night: I was referencing the UC
type instead of the actual instance in a Property:
public MapConfig MapConfig
{
get { return this.MapConfig; }
set
{
this.resetControl();
this.MapConfig = value;
if (this.MapConfig != null)
{
// etc
SHOULD have been:
public MapConfig MapConfig
{
get { return this.config; }
set
{
this.resetControl();
this.config = value;
if (this.config != null)
{
Thanks for the response though!
I am confused about two things though: first of all, why would this
even compile? Second of all, why would it cause VS to shut down?
Joel
Marc Gravell - 27 Apr 2006 14:37 GMT
Well, the second would be because of the infinite loop while trying to read
(or write) your control's values...
It copes with exceptions OK (message-boxing them), but this? tricky...
The first would be because it isn't illegal? Very inadvisable, definately,
but not illegal. There should maybe (as a suggestion for a tweak) be a
recursion warning about properties invoking themselves, though - i.e. the
setter calling the same setter on the "this" instance (or similar with
static); that might be a nice feature...
Marc
Marc Gravell - 27 Apr 2006 14:39 GMT
ar right, /now/ I see your question about not compiling; you /weren't/ using
the UC type; you were referencing the MapConfig property on the current
instance. In this scenario, you can get at the UC type only by using more of
the namespace.
Marc