Greetings!

Everytime I use msgbox command the active form view is disappear when the message box executed. And it appears again after the message box finished the execution.

Anybody know how to display message box without disappearing the active form view.. I want to restore the form display when the message box appear.

thanks in advance

Dani AI

Generated

A few clarifications and practical checks that build on and without repeating their examples.

Most message boxes are modal and only take focus — they do not unload a parent form by themselves. Common causes for the behavior described are: the form being hidden/minimized by earlier code, an unusual window/border style that changes the OS z-order/redraw behavior when a dialog appears, or calling a message routine without specifying an owner window (which can make the dialog appear in a different z-order). A quick isolation test is to reproduce the call in a tiny new project; if the form stays visible there, the problem is in the original form’s code or style.

Practical actions:

  • Inspect the form code for any Hide/Unload/WindowState changes or visible flags that run before the message is shown. Those are the usual culprits.
  • For WinForms (VB.NET) use the owner overload so the message box is owned by the form and the z-order/redraw is handled correctly. Example:
MessageBox.Show(Me, "Status text", "Title", MessageBoxButtons.OK, MessageBoxIcon.Information)
  • For classic VB, MsgBox is modal; to show a non-blocking message keep a small custom form and show it modelessly rather than relying on the system dialog.
  • If a border/style change fixed it for , try toggling the form’s window style (standard overlapped vs dialog/tool window) while testing; some styles affect how Windows composes and repaints the owner window when dialogs appear.

References for behavior and overloads:
MessageBox.Show (WinForms)

MsgBox function (Microsoft.VisualBasic.Interaction)

If the minimal test reproduces the problem, the issue is likely environmental (OS/theme/third-party UI hooks) rather than the message API itself.

Recommended Answers

All 2 Replies

do you have the code of the form and the message box
msgbox("hello",vbokonly,"hello ")the default form should not dissappear.
try adopting my code jireh hope it help you as far as i know the view form should not disappear unless ur software has a problem.
make the for visilble form1.visible= true after the messagebox

Hi locsin,

I guess, you must have set Form's
Border = Fixed Dialog,
make it
Border = Fixed Single
With msgbox, you form will not disappear..

Regards
Veena

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.