-
Is there a way to prevent click events from initiating while a previous event is being processed?
ie.
I have a form with many command buttons, and when I click one of them, I want to ignore any other click on other objects until the routine from the first click terminates.
It happens that I have a comm port trans, and the user clicks on objects while the system is handling an interrupt routine. I would like to be able to ignore new events, and perhaps inform the user that the system is busy.
Please, any info?
NV
-
DoEvents
Add DoEvents as the first line in each click statement....
-
Thanks for the info,
I will use DoEvent an other part of my program, but I don't think I explained my situation accurately.
Sometimes when you have many buttons on a form and you press a bunch of them in sequence, you want to IGNORE the ones that were pressed. This prevents unintentional clicks when the system is busy.
Hope you can help,
NV
-
You could always disable the other buttons until the one running is completed.
i.e.
Code:
Private Sub Command1_Click()
Command2.Enabled = False
Command3.Enabled = False
'.......CODE HERE..........
Command2.Enabled = True
Command3.Enabled = True
End Sub
Private Sub Command2_Click()
Command1.Enabled = False
Command3.Enabled = False
'.......CODE HERE..........
Command1.Enabled = True
Command3.Enabled = True
End Sub
'ETC
-
a quick fix might be
"form1.enabled = false"
-
why don't you try declaring a global Boolean}
Variable and when you start the sub set it to False
an d in the first line of the other subs
put somthing like this
'Global Variable Control
Dim DoClik as Boolean
If DoClik = False then Exit Sub
'The rest of your Code...
-
Oops
I Forgot when you Finish your Process
Set the Variable to True!!