devxlogo

Making a System Modal Message

Making a System Modal Message

Question:
How can I make it so that a form will stay on top until the user presses a button? For example, an error message pops up, the user can’t click elsewhere on the screen to close the window until he presses the button.

Answer:
Using the MsgBox function, you can make a message System Modal, which will prevent them from doing anything in ANY application until they answer the question. When you use the MsgBox call, add in the MB_SYSTEMMODAL constant to the other constants which determine buttons, icons and such to display. The constant is listed in CONSTANT.TXT. For VB4, see the Help for MsgBox and use either vbApplicationModal or vbSystemModal.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist