8

After having a problem with a message box activating lots of times in VB.NET when a form is displayed, I came across this question which also had the same problem.

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:

  1. 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.
  2. 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.
  3. 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?

  • 1
    I'd go firstly with #1 hoping the user who answred to fix the post. If nothing, one can wait a bit. If the comment get upvoted (lets say +5), then edit the answer. Otherwise, go with your own answer. – Andre Silva Apr 12 '14 at 17:48
  • It was pointed out by "Stephen" that the answer didn't work and the author "jonsca" responded. However Stephen worked around the problem by removing the MsgBox so jonsca may not have realised that the answer was wrong. The last update was nearly 3 years ago. – Richard Apr 12 '14 at 17:52
  • 1
    According to jonsca' profile he/she logged on SO 14 hours ago. That is a indicative a comment might work. – Andre Silva Apr 12 '14 at 17:59
  • Thank you for your input. All taken care of. I'm not sure this entire MSO post was warranted over something that would have taken 2 seconds to write a comment about. – jonsca Apr 13 '14 at 19:47
  • Apologies, the issue was more what the etiquette is for situations like this. I couldn't find any documentation that explained what I should do and thought I should ask before I step on anyone's toes! – Richard Apr 14 '14 at 16:37
7

You should first add a comment to the answerer with an explanation and wait to see if the answerer responds.

If not your second choice is to add another answer with an explanation. The answer will be noticed : 1) because the question will be bumped up and 2) there is a late answer review queue.

The third option is never recommended.

  • just to touch on this to avoid asking a similar question... if the answer is not accepted, but wrong should I edit the answer or make a comment or just make a new answer? – Cayce K Jul 13 '15 at 19:46
  • @CayceK same procedure – Mhmd Jul 14 '15 at 9:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .