HOWTO: Tell if UserControl is in Design-Time or Run-TimeLast reviewed: October 16, 1997Article ID: Q175222 |
The information in this article applies to:
SUMMARYWhen creating a UserControl in Visual Basic you may have code that you don't what to run when the control is on a Form at design-time, but you do want to run when the Form is in run-time. This article shows how to use the AmbientProperties Object to tell when a host container of a control is in design or run-time.
MORE INFORMATIONWhen a UserControl is placed on a form, any constituent controls that are in the control are in run-time mode, not design-time mode. Usually this does not cause any trouble for the developer. But there are cases where you need to have an event happen only when the container for the UserControl is in run-time. The following example shows how to enable or disable a Timer control by testing to see if the container is in design-time or run-time.
Step-by-Step Example
REFERENCESVisual Basic Component Tools Guide, Chapter 9.
|
Additional query words: ActiveX Control
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |