473,835 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
+ 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.IsNull OrEmpty(keyword ))
{
System.Windows. Forms.MessageBo x.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.InvalidO perationExcepti on: Showing a modal dialog box or form
when the application is not running in UserInteractive mode is not a
valid operation. Specify the ServiceNotifica tion or DefaultDesktopO nly
style to display a notification from a service application.
What does this mean ?

Thanks!

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

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

if (!string.IsNull OrEmpty(keyword ))
{
System.Windows. Forms.MessageBo x.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.InvalidO perationExcepti on: Showing a modal dialog box or form
when the application is not running in UserInteractive mode is not a
valid operation. Specify the ServiceNotifica tion or DefaultDesktopO nly
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.MessageBo x.Show("sometex t");

Thanks!

On Mar 27, 10:01 am, "khmer_love rs" <khmer_lov...@y ahoo.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.co m

"Zeba" <co******@gmail .comwrote in message
news:11******** *************@y 80g2000hsf.goog legroups.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
929
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 automate it so as to set the row errors. Is this possible? Thanks in advance... rakesh
0
1081
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 automate it so as to set the row errors. Is this possible? Thanks in advance... rakesh
3
7435
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 bitching at .NET for the whole day now not being able to do something as simple as showing a textbox's content in a damn MessageBox... The TextBox.Text is a String... MessageBox takes a LPCSTR (plain single byte char*)... All our current code base...
0
4092
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; namespace Utils {
4
1394
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 it a XP or dotNet bug? Kind Regards, Allan Ebdrup
20
8918
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 works just fine. If I put the call in the .cpp file, I get the following two errors: error C2653: 'MessageBoxA': is not a class or namespace name error C2660: 'System::Windows::Forms::Control::Show': function does not take
2
10953
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 selection the user makes with the radio buttons. MessageBox.Show (txtTitle.Text, txtMessage.Text, grpButtons()) where I have grpButtons() is where Im having the problem, Im trying to have the message box display what the user chooses. Can this be...
3
2546
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 program reports this with a messagebox, not on the console. Can someone tell me if it is possible to: - disable/hide the popup errors from external app? - catch the error messages via standarderror or some other way?
3
8080
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 AppDomain.CurrentDomain.UnhandledException or System.Windows.Application.Current.DispatcherUnhandledException event handlers handle any errors. In the error handling routine, I can call MessageBox.Show to display an error message to the user. This kinda works, as the messagebox
0
9653
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10815
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10563
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10237
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9348
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5640
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5808
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4435
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 we have to send another system
3
3094
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.