Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hello World
Message
From
31/07/2009 14:19:26
 
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Environment versions
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Novell 6.x
Database:
MS SQL Server
Miscellaneous
Thread ID:
01415697
Message ID:
01415702
Views:
70
>I have a form with a single button on it. In the click event i have the following code: MessageBox.Show("Hello, World!");
>
>The code does not work. How do I get my application to say hello?

How did you create the event handler? To code it yourself its:just
public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.button1.Click += new System.EventHandler(this.button1_Click);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Hello World");
        }
    }
If you created the handler by doubleclicking on the button (or from the Properties window) then the
this.button1.Click += new System.EventHandler(this.button1_Click);
line would be automatically added to the InitializeComponent() method - you can check this by looking in the Form1.Designer.cs file (all this assuming your form IS called Form1 of course)
Previous
Reply
Map
View

Click here to load this message in the networking platform