Why does my USER CONTROL keep disappearing ?

  • Thread starter Thread starter Lee Gillie
  • Start date Start date
L

Lee Gillie

I'm not sure what causes it, but occasionally my USER CONTROL half way
disappears from the form I am working on. I detect design mode and have
an innocuous gradient fill paint for that, which does not interact with
the control heavily. When it goes, it doesn't completely go, there is
still a control variable for it, but the code to instance it, and
initialize its properties goes away. The program can not run, of course,
with no instance. And I can not add the control now. I exit IDE, come
back in, add the control again, and then have to play some
search/replace games to get the name of UC2 back to UC1.

Can I fix it? Can I avoid it? What causes it?

Best regards - Lee Gillie, Spokane WA
 
Probably there's a bug in your control's design time components. Are you
using designer classes or typeconverters? Can you post some code?
 
joeycalisay said:
Probably there's a bug in your control's design time components. Are you
using designer classes or typeconverters? Can you post some code?

Joey -

I do not understand your question about designer classes or
typeconverters. This is a usercontrol with a couple of scroll bars, and
a custom client area paint override.

I really can't post code, but I can say I override a lot of mouse and
other OnXXX handlers. I always invoke the base-class on-handlers in my
override. The only OnXXX handler that I have made sensitive to being in
design mode is the paint routine, in which I use a simple paint that
does not utilize the runtime state of the object. Maybe there are more
on-handlers being called in design mode than I realize?

I think I need to explore the docs more for techniques to debug
design-time behaviour. I don't get any error messages, which may give
some hints, the damn thing just disappears, and only half-way.

Thanks for giving some hints/direction here.

Best regards - Lee
 
This seems to prevent the issue for me: Don't ever open the form in design
view if there is not a compiled version of the assembly available. In other
words, always compile before opening the form in design view.

If the control is not being deleted, you can take a look in your .resx file
for the form, and you will probably notice the size of the control has been
changed to 0,0 or something annoying like that. This is a well discussed
problem. Hopefully the next version does something to address this. I know
I've spent countless hours battling this same issue in the past...
 
Thanks Cheese -

I'll not focus some much time to trying to mitigate something that is a
problem in the platform.

Best regards - Lee
 
Back
Top