
Signature
Thanks in advance,
Juan Dent, M.Sc.
Hi Juan,
Thank you for posting.
Do you mean that you couldn't open the form that has some user controls on
it in the designer?
When a form with a user control on it is displayed in the designer, VS IDE
will call the code in the user control's constructor and event handler for
the user control's Load event.
So you shouldn't place any code regarding connecting database or any
operation on the database in the user control's constructor and event
handler for the user control's Load event.
Besides, if there's only one constructor in the user control class, the
constructor shouldn't take any parameter. If you need pass parameters in
the constructor, you could add a constructor which has no parameter.
Hope this helps.
Please try my suggestions and let me know the result.
Sincerely,
Linda Liu
Microsoft Online Community Support
============================================================================
=============================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed
to the limited number of phone-based technical support incidents. Complex
issues or server-down situations are not recommended for the newsgroups.
Issues of this nature are best handled working with a Microsoft Support
Engineer using one of your phone-based incidents.
============================================================================
=============================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Juan Dent - 18 Jul 2006 22:19 GMT
Hi,
Your comments were very helpfull. I wonder if there is a way to know if the
control is in design time or runtime?
So that we can code around...

Signature
Thanks in advance,
Juan Dent, M.Sc.
> Hi Juan,
>
[quoted text clipped - 37 lines]
> =============================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
Linda Liu [MSFT] - 19 Jul 2006 04:54 GMT
Hi Juan,
Thank you for your response.
There's a property of Component called DesignMode. This property gets a
value that indicates whether the Component is currently in design mode. If
the Component is in design mode, the value of the property is true;
otherwise, false.
Since UserControl is inherited from Component in hiberarchy, UserControl
aslo has DesignMode property. You could use this property to know whether
the UserControl is in design mode.
Hope this helps.
If you have anything unclear, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support