----------------------------------- vg19 Tue Apr 27, 2004 4:48 pm Disabling Procedure ----------------------------------- Hi, 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 ----------------------------------- Tony Tue Apr 27, 2004 5:00 pm ----------------------------------- sounds like a bad programming practice... but... if you must... sub myProcedure(flag as boolean) if flag then end '// should exit the procedure. Not sure on syntax. end if print "flag was false, procedure is running end sub ----------------------------------- Brightguy Tue Apr 27, 2004 8:22 pm Re: Disabling Procedure ----------------------------------- Private Sub Proc() Static blnDisabled As Boolean If blnDisabled = True Then Exit Sub End If If Then 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 Wed Apr 28, 2004 10:19 am ----------------------------------- ^ good code. If you are looking to turn off the button that is calling the procedure use: btnWhatever.Enabled = False at the end of the sub