Click to See Complete Forum and Search --> : Activate control
noble
Feb 8th, 2001, 06:49 AM
I have a control which i created which is activated
based on a boolean property. What is the best way
to monitor this property so that my control will be
activated?
thx for any help
jonaxse
Feb 8th, 2001, 07:47 AM
2 ways:
1.> You make a property called, (for example) "IsActivated" which would accept and return boolean values. Then call the code that will activate your control on the property procedure that "sets" the boolean value. For example:
Public Property Let IsActivated(ByVal pb_Activate As Boolean)
YourLocalVariable = pb_Activate
If pb_Activate = True Then
Call ProcedureForActivatingMyControl()
End If
End Property
2.> Or, you can simply put a public method on your control to Deactivate/Activate it: (Here is an example)
Public Function ActivateMyControl() As Boolean
On Error Goto Hell
'do activation code here...
blah blah blah....
ActivateMyControl = True
Exit Function
Hell:
ActivatemyControl = False
End Function
Public Function DeactivateMyControl() As Boolean
'do as above... except, do the deactivation code here...
End Function
NOTE: If you are asking what is the best, my answer would be to make a public method to activate or deactivate the control. (I hate properties :D)
Hope that helps :D
noble
Feb 8th, 2001, 11:22 AM
ty, that is waht i have done
I would like to steer away from calling a procedure as
my control will be working as long as it's activated and
i dont want to eat up unecessary processor time.
I decided to enable a timer when the flag is set to true
which handles my control
thx for the help.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.