Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hello World
Message
De
31/07/2009 14:19:26
 
 
À
31/07/2009 13:28:16
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Novell 6.x
Database:
MS SQL Server
Divers
Thread ID:
01415697
Message ID:
01415702
Vues:
69
>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)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform