I have an old VB6 application which I am reworking to VB.NET and the previous programmer set this sort of thing when validating MaskedTextBox components:
MsgBox("My message")
b = True
myField.Focus()
Basically, a message box is open and if the validation failed the focus should get to other myField text component.
I changed the Enter event to GotFocus and now when the validation fails I am stuck on the current text field forever. I cannot even close the window because of the constant message box that appears.
I fixed the problem on GotFocus by moving the other statements above the MsgBox() command.
Yes it works well now, but really want to understand how does MsgBox affects the execution of the program?
From MSDN:
Displays a message window, also known as a dialog box, which presents a message to the user. It is a modal window, blocking other actions in the application until the user closes it. A MessageBox can contain text, buttons, and symbols that inform and instruct the user.
I can only guess it was either used for debugging or to give out an error message to the user.
If it was for an error message this might help: Call MessageBox from async thread with Form1 as parent