473,320 Members | 1,848 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,320 software developers and data experts.

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 1602

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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.