I have a button. Its OnClick event calls a procedure which destroys the button, but then the “thread” wants to return to the OnClick event and I get an access violation.
I’m completely stumped!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to destroy the button after all its code is finished executing. The standard way to do this is by posting a user-defined message to the form and giving the form a message method that will interpret it. For example:
This works because the message gets put into the Windows Message Queue and doesn’t come out until everything before it (including the Click message that the button is currently responding to) is finished processing.