473,394 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Pop up MessageBox and close whole program

Hi all,

I have this messagebox that prompts when a fatal error occurs and i
would like the user to click okie and the whole pgm would exit

MessageBox.Show(errorMsg, "Error");

how am i able to do it?

appreciate any help

Sep 18 '06 #1
2 2118
Hi ahjiang,

"ah*****@gmail.com" wrote:
Hi all,

I have this messagebox that prompts when a fatal error occurs and i
would like the user to click okie and the whole pgm would exit
Hope this helps,

DialogResult ret = MessageBox.Show("Show", "Exit",MessageBoxButtons.YesNo);
Console.WriteLine(ret.ToString());
if (ret == DialogResult.Yes)
Application.Exit();
else if (ret == DialogResult.No)
MessageBox.Show("Pressed No");

DialogResult stores the button value what is been clicked. With that you can
get all return types.

Regards,
C.C.Chakkaradeep
Sep 18 '06 #2
if(DialogResult.Yes == MessageBox.Show("Really quit?", "Quit",
MessageBoxButtons.YesNo))
{
Application.Exit();
}

HTH

Simon

<ah*****@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Hi all,

I have this messagebox that prompts when a fatal error occurs and i
would like the user to click okie and the whole pgm would exit

MessageBox.Show(errorMsg, "Error");

how am i able to do it?

appreciate any help

Sep 18 '06 #3

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

Similar topics

3
by: s-galit | last post by:
hi, i have a module that created a form, and the messageBox is shown in the closing event , but when the im choosing the "cancel" button in the messageBox the messageBox and also the form is...
4
by: PawelR | last post by:
Hello group, In my apps I connection to SQL database. try { //connect to db } catch { MessageBox("Error Connect. Close Apps?","Sql Error",MessageBoxButtons.OKCancel,MessageBoxIcon.Error);
10
by: Russ | last post by:
I've been trying to figure out how to show a simple messagebox with an OK button in my web client program (C#). I have looked at every reference to JScript and MessageBox that seemed even remotely...
4
by: Larry Woods | last post by:
I have a Messagebox that looks like: MessageBox.Show("There are pending changes for this patient. Do you want to continue to close?", "Pending Changes", MessageBoxButtons.YesNo,...
2
by: David | last post by:
Is there anyway to get a different DialogResult or detect that the user clicked the close button on a MessageBox? I have a message box that pops up when my program first starts that only has an ok...
2
by: Nuno Magalhaes | last post by:
Why does the MessageBox.Show function in the thread below changes the program behaviour, in other words, the APListView becomes filled with values with a call to RefreshAPListView. Without the...
3
by: rdemyan via AccessMonster.com | last post by:
Sometimes users (including myself) accidentally click on the application close icon in the application menu bar when they meant to just click on the 'X' for the form. Of course the app closes and...
4
by: TonyJ | last post by:
Hello! I have a small program that just copy a file and make some checks in main then I just want to inform the user about something by using a MessageBox. I tried to use this in the...
6
by: Frank Rizzo | last post by:
I am trying to programmatically close a messagebox. I don't see any obvious managed choices. Back in the day, I remember using a combination of FindWindow and EndDialog apis(...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
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...

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.