Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UserControl Timer

Status
Not open for further replies.

Smokey

Programmer
Oct 9, 2000
13
0
0
US
I have a UserControl that uses a timer. My UserControl works great, but when I'm in the design environment, the timer still runs which slows down everything even more. I was hoping there was a way to disable the timer when in the design environment and re-enable it when running the program?
 
Use the following function to check if you're in design environment. I also made it available as FAQ.

Public Function TestEnv() As Boolean
Dim buffer As String
Dim EnvFileName As String
Dim Envs As Variant
Dim nRet As Long
Dim i As Long

Envs = Array("vb.exe", "vb32.exe", "vb5.exe", "vb6.exe")

For i = LBound(Envs) To UBound(Envs)
buffer = Envs(i)
nRet = GetModuleHandle(buffer)
If nRet <> 0 Then
EnvFileName = buffer
TestEnv = True
Exit For
End If
Next
End Function


Herman :-Q
 
Anyone know how to use the Ambient property? I used the AmbientChanged event to set Timer.Enabled = Not Ambient.UIDead, but the event didn't trigger when it seemed it should; during the Initialize event, the Ambient property's client site is unavailable; you can't use the Ambient property in in #if ... #End If block; isn't there some way to actually disable the timer in design mode?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top