-
Hello
I'm not very good about this control-collection stuff.
I'm trying to make 2 sub's that takes a form as argument and then checkes if there is any timer in that form.
Sub1 disables the timer & Sub2 Enables the timer.
I tried with
Code:
Publc sub DisAbleTimer(Frm as Form)
Dim Ctrl as Control
For Each Ctrl in Frm
if Ctrl=Timer then
Ctrl.Enable=False 'make it disabled
end if
next Ctrl
End Sub
But it didn't work. Any ideas about how to do this??
I'm using VB5 SP3 on this project.
Thank you
-
You need to use the typeName function to return what type of contorl it is.
Code:
Publc sub DisAbleTimer(Frm as Form)
Dim Ctrl as Control
For Each Ctrl in Frm
if typeName(Ctrl) = Timer then
Ctrl.Enable=False 'make it disabled
end if
next Ctrl
End Sub
-
Use the Typename function:
Code:
Publc sub DisAbleTimer(Frm as Form)
Dim Ctrl as Control
For Each Ctrl in Frm
if TypeName(Ctrl) = "Timer"
then
Ctrl.Enable=False 'make it disabled
end if
next Ctrl
End Sub
-
Typename in VB5
Thank you both the speedy reply :0)
a few additional Q's for this topic.
Is Typename avaible in VB 5??
Is it TypeOf that is a VB6-function?
Can I use VB6-functions in VB5 if I have the Msvbvm60.dll in my machine?
If so do I have to deliver the Msvbvm50.dll with my setup if I deliver the Msvbvm60.dll-file??
just qurious
-
1. Typename and TypeOf are both in VB5 Enterprise Edition
2. You can only use Msvbvm60.dll for compiled vb6 code
-
Good
Thank you Kedaman
Then I can saftly use TapeName or TypeOf within my app.