H
Harvey
Hello:
I would appreciate if anyone could tell me why the
following occurred in my WinForms app. I am using a User
control and everything was running ok until I defined the
following property:
public int Height
// Height of the control in pixels
{
get
{
return this.Height;
}
set
{
this.Height = value;
}
}
Then, when I made the following call:
this.Height = Math.Max((ctl.Top + ctl.Height),
this.Height);
the stack overflow error would reproducibly occur. Yet
the app compiled without error.
Could someone explain what is going on here? I imagine it
has something to do with property overriding, but if that
is the case, why is not a compilation error thrown?
thanks in advance.
Regards,
Harvey
I would appreciate if anyone could tell me why the
following occurred in my WinForms app. I am using a User
control and everything was running ok until I defined the
following property:
public int Height
// Height of the control in pixels
{
get
{
return this.Height;
}
set
{
this.Height = value;
}
}
Then, when I made the following call:
this.Height = Math.Max((ctl.Top + ctl.Height),
this.Height);
the stack overflow error would reproducibly occur. Yet
the app compiled without error.
Could someone explain what is going on here? I imagine it
has something to do with property overriding, but if that
is the case, why is not a compilation error thrown?
thanks in advance.
Regards,
Harvey