Music Lover

when I add a msgbox("hello")
it returns
"It is invalid to show a modal dialog or form when the application is not
running in UserInteractive mode. Specify the ServiceNotification or
DefaultDesktopOnly style to display a notification from a service
application. "

What should I do in order to make a msgbox work?
Thanks in advance





pls post code that cause the error.

In addition, please explain what you wish to do.

I did some searching on goggle and found that this error
is usually resulted when an asp application is try to
open a message box.


Kevin Spencer

The VB MsgBox function can not be used in a web application. It calls a
Windows API to display a Message Box on the machine on which the application
is running. ASP.Net is used to create web applications, where the users of
the applications are nowhere near the machine running the app. They are
looking at an HTML document in a web browser. If you want to pop up a
Message Box on the browser, you have to include JavaScript in your ASP.Net
page that does so on the client browser (something like: alert("Your
message");). To do this in ASP.Net, you would use
Page.RegisterStartupScript() in your CodeBehind. See the following SDK
article for details:


Kevin Spencer
Microsoft MVP
..Net Developer
Big Things are made up of
Lots of Little Things.



Mr Helpfull

Use a label control (normally hidden; generally at top of
page); when needed, change its back color to something
like light yellow, apply appropriate text, and make it

With a default property of hidden, it is out of sight
until needed.

And no client side script needed.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

MsgBox in ASP.NET? 1
MsgBox 2
Enterprise Logging does nothing on server 5
MsgBox Error 1
Window Services XML Export Error 1
Weird ASP.NET 2.0 Error 1
msgbox 1