473,471 Members | 4,625 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Why doesn't the slightest change to a Hello World program run?

using System.Windows.Forms;

class MessageBoxHelloWorld

{

public static void Main()

{

MessageBox.Show("Hello, world!", "MessageBoxHelloWorld"); // Runs ok

MessageBox.Show("Hello, world!", "MessageBoxHelloWorld",
MessageBoxButtons.Abort); // Doesn't compile

}

}


Nov 16 '05 #1
3 1607

There's no such value as MessageBoxButtons.Abort. If you want the abort
button, you need to specify MessageBoxButtons.AbortRetryIgnore.

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com
"Bupkas" <bu****@cox.net> wrote in message
news:eN*************@tk2msftngp13.phx.gbl...
using System.Windows.Forms;

class MessageBoxHelloWorld

{

public static void Main()

{

MessageBox.Show("Hello, world!", "MessageBoxHelloWorld"); // Runs ok

MessageBox.Show("Hello, world!", "MessageBoxHelloWorld",
MessageBoxButtons.Abort); // Doesn't compile

}

}

Nov 16 '05 #2
Thanks. Orignally when I caused the error I had the line,

System.Windows.Forms.MessageBox.Show("string1","st ring2",MessageBoxButtons.O
KCancel);

which still doesn't work. However, when I introduced "using" in the
following line,
using System.Windows.Forms;

and then abridged the one line to,

MessageBox.Show("Hello, world!", "MessageBoxHelloWorld",
MessageBoxButtons.OKCancel);

I introduced the error to "MessageBoxButtons.Abort" while playing with
"MessageBoxIcon.

Now it works. I guess the "using" line is necessary for some reason.

Appreciation expressed. :)

"Mickey Williams" <my first name at servergeek.com> wrote in message
news:uD*************@tk2msftngp13.phx.gbl...

There's no such value as MessageBoxButtons.Abort. If you want the abort
button, you need to specify MessageBoxButtons.AbortRetryIgnore.

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com
"Bupkas" <bu****@cox.net> wrote in message
news:eN*************@tk2msftngp13.phx.gbl...
using System.Windows.Forms;

class MessageBoxHelloWorld

{

public static void Main()

{

MessageBox.Show("Hello, world!", "MessageBoxHelloWorld"); // Runs ok

MessageBox.Show("Hello, world!", "MessageBoxHelloWorld",
MessageBoxButtons.Abort); // Doesn't compile

}

}


Nov 16 '05 #3
Bupkas,

The using statement is required because the MessageBox class
is located in the System.Windows.Forms namespace. Without the
using statement you could have to use the fullname or not use the
class at all =)

HTH,

//Andreas

--
ANDREAS HÅKANSSON
STUDENT OF SOFTWARE ENGINEERING
andreas (at) selfinflicted.org
"Bupkas" <bu****@cox.net> wrote in message news:#Z**************@TK2MSFTNGP11.phx.gbl...
Thanks. Orignally when I caused the error I had the line,

System.Windows.Forms.MessageBox.Show("string1","st ring2",MessageBoxButtons.O
KCancel);

which still doesn't work. However, when I introduced "using" in the
following line,
using System.Windows.Forms;

and then abridged the one line to,

MessageBox.Show("Hello, world!", "MessageBoxHelloWorld",
MessageBoxButtons.OKCancel);

I introduced the error to "MessageBoxButtons.Abort" while playing with
"MessageBoxIcon.

Now it works. I guess the "using" line is necessary for some reason.

Appreciation expressed. :)

"Mickey Williams" <my first name at servergeek.com> wrote in message
news:uD*************@tk2msftngp13.phx.gbl...

There's no such value as MessageBoxButtons.Abort. If you want the abort
button, you need to specify MessageBoxButtons.AbortRetryIgnore.

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com
"Bupkas" <bu****@cox.net> wrote in message
news:eN*************@tk2msftngp13.phx.gbl...
using System.Windows.Forms;

class MessageBoxHelloWorld

{

public static void Main()

{

MessageBox.Show("Hello, world!", "MessageBoxHelloWorld"); // Runs ok

MessageBox.Show("Hello, world!", "MessageBoxHelloWorld",
MessageBoxButtons.Abort); // Doesn't compile

}

}


Nov 16 '05 #4

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

Similar topics

3
by: Bupkas | last post by:
using System.Windows.Forms; class MessageBoxHelloWorld { public static void Main() {
3
by: Bupkas | last post by:
using System.Windows.Forms; class MessageBoxHelloWorld { public static void Main() {
3
by: Bupkas | last post by:
using System.Windows.Forms; class MessageBoxHelloWorld { public static void Main() {
3
by: Bupkas | last post by:
using System.Windows.Forms; class MessageBoxHelloWorld { public static void Main() {
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
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...
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,...
1
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...
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,...
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
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.