473,473 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

MessageBox in C# - errors

Hi guys,

I gave the following code in the page load function of one of my
codebehind pages :

if (!string.IsNullOrEmpty(keyword))
{
System.Windows.Forms.MessageBox.Show("Got your keyword!!");
SearchByKeyword();
}

I also included the reference for System.Windows.Forms, but I when I
try to view the page I get the error :

System.InvalidOperationException: Showing a modal dialog box or form
when the application is not running in UserInteractive mode is not a
valid operation. Specify the ServiceNotification or DefaultDesktopOnly
style to display a notification from a service application.
What does this mean ?

Thanks!

Mar 27 '07 #1
4 6348
you can't show messagebox in a web page. use Response.Write("bla bla");
instead.
"Zeba" <co******@gmail.comwrote in message
news:11**********************@l77g2000hsb.googlegr oups.com...
Hi guys,

I gave the following code in the page load function of one of my
codebehind pages :

if (!string.IsNullOrEmpty(keyword))
{
System.Windows.Forms.MessageBox.Show("Got your keyword!!");
SearchByKeyword();
}

I also included the reference for System.Windows.Forms, but I when I
try to view the page I get the error :

System.InvalidOperationException: Showing a modal dialog box or form
when the application is not running in UserInteractive mode is not a
valid operation. Specify the ServiceNotification or DefaultDesktopOnly
style to display a notification from a service application.
What does this mean ?

Thanks!

Mar 27 '07 #2
So then in what context would you use

System.Windows.Forms.MessageBox.Show("sometext");

Thanks!

On Mar 27, 10:01 am, "khmer_lovers" <khmer_lov...@yahoo.comwrote:
you can't show messagebox in a web page. use Response.Write("bla bla");
instead.

Mar 27 '07 #3
Oh ok..I get it.you mean you can use it only in windows application.
Thanks!

On Mar 27, 10:27 am, "Zeba" <coolz...@gmail.comwrote:
So then in what context would you use
Mar 27 '07 #4
Zeba,

Also, you don't have to write on the page if you don't want to. You can
insert text into the page which will call the Javascript function alert (on
the inherent window object exposed by the browser) in order to show a
messagebox on the client.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Zeba" <co******@gmail.comwrote in message
news:11*********************@y80g2000hsf.googlegro ups.com...
Oh ok..I get it.you mean you can use it only in windows application.
Thanks!

On Mar 27, 10:27 am, "Zeba" <coolz...@gmail.comwrote:
>So then in what context would you use

Mar 27 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Rakesh | last post by:
Hi, The default behaviour of the datatable when a data doesn't adhere to a constraint is to pop-up a messagebox and state the rule. I would like to disable this behaviour and if possible...
0
by: rakesh | last post by:
Hi, The default behaviour of the datatable when a data doesn't adhere to a constraint is to pop-up a messagebox and state the rule. I would like to disable this behaviour and if possible...
3
by: Sin | last post by:
I'm currently evaluating VC.NET as the new platform for the company I work for and things are looking grim... We're up against another IDE which took me about 5 minutes to master and I've been...
0
by: alex_f_il | last post by:
The class centers MessageBox inside the parent rectangle. Enjoy! using System; using System.Windows.Forms; using System.Text; using System.Drawing; using System.Runtime.InteropServices; ...
4
by: Allan Ebdrup | last post by:
When I try to Messagebox.Show() a string that is 197680 or more chars long, my call is simply ignored, no error is thrown, the call is simply ignored. 197679 chars or shorter is shown correctly. Is...
20
by: Peter E. Granger | last post by:
I'm having a strange problem (or at least it seems strange to me) trying to display a MessageBox in a VC++ .NET forms application. If I put the call to MessageBox::Show in the form's .h file, it...
2
by: Sarge | last post by:
Hello, I have a group box (grpButtons) with four radio buttons (radAbortRetryIgnore, radOK, radOKCancel, radYesNo) what I am trying to do is display the buttons in the messagebox based on the...
3
by: robiman | last post by:
Hi, I'm running an external program using System.Diagnostics Process. This program creates a PDF file from a CAD file via commandline "me10f.exe - p filename.mi". But in case of errors the...
3
by: Andy | last post by:
Hi, I have a Wpf application, and have some code in my App.xaml.cs file that runs on Application_StartUp. It's possible for errors to occur here, and I let...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.