I am doing a vb program in which I want to disable a produre. Basically I have a Call statement. Then I have an if statement in the proceudre. What I want to do is if the If statement inside the procedure has been run once, it should disable and never be run again. I am not sure if this can be done.
Please help
Sponsor Sponsor
Tony
Posted: Tue Apr 27, 2004 5:00 pm Post subject: (No subject)
sounds like a bad programming practice... but... if you must...
code:
sub myProcedure(flag as boolean)
if flag then
end '// should exit the procedure. Not sure on syntax.
end if
Private Sub Proc()
Static blnDisabled As Boolean
If blnDisabled = True Then
Exit Sub
End If
If <Conditions> Then
<Statements>
blnDisabled = True
End If
End Sub
Once the code in the If statement has been run, the procedure will be "disabled". You can move blnDisabled = True outside of the If statement to always disable the procedure regardless of the conditions, if that's what you wanted.
McKenzie
Posted: Wed Apr 28, 2004 10:19 am Post subject: (No subject)
^ good code.
If you are looking to turn off the button that is calling the procedure use: