PDA

Click to See Complete Forum and Search --> : How to check for runtime


pax
Mar 4th, 2001, 03:27 PM
When creating ActiveX controls with timer events, the timer may start when using it in design time of the VB project, which may cause flicker and other bad stuff.

I need for my control to check if the parent application is in design time or run time.

At the moment I use the Show event of my usercontrol.

I use the :
"parent.ShowInTaskbar = parent.ShowInTaskbar"
and then trap the error, because the ShowInTaskbar property is Read-Only in runtime.
This works OK, but I think there must be a better way telling.

Does anyone know how to do this the "Real" way?

Thx in advance.

Pax

Aaron Young
Mar 4th, 2001, 08:30 PM
Use the UserMode property of the Ambient object of the UserControl, it returns True when in Runtime mode and False when in Designtime mode, i.e.Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
If UserControl.Ambient.UserMode Then
Label1 = "Runtime"
Else
Label1 = "Design Time"
End If
End Sub

pax
Mar 5th, 2001, 10:27 AM
Thank's alot.

I guess I still have a lot to learn about ActiveX development ;-)

Greetings

Pax