Unfortunately the answer given (and accepted) is slightly incorrect. It states the code should be:
Static HasRan As Boolean=False If Not HasRan Then 'put code here HasRan=True End If
whereas it should be:
Static HasRan As Boolean=False If Not HasRan Then HasRan=True 'put code here End If
This can be easily proven by putting
MsgBox("hello") in place of the
'put code here and testing it. The accepted solution will continue to trigger the MsgBox multiple times.
I have three options:
- Add a comment pointing this out in the hope that someone will see it and realise that the answer is wrong. The answer continues to be wrong and diminishes the value of Stack Overflow accepted answers.
- Add a new answer with the correct code and accept that it'll never be marked as the correct answer and possibly not voted up. Again, the answer continues to be wrong and diminishes the value of Stack Overflow accepted answers.
- Edit the answer to the correct way around and then add a reference to the fact that it has been done. However I'm aware that this policy could backfire if well-meaning (but incorrect) edits are done to accepted posts.
Which should I do?