Sunday, January 11, 2009

c# control tutorial example

using System;
using System.Drawing;
using System.Windows.Forms;

public class MainForm : Form
{
public static void Main()
{
MainForm MyForm = new MainForm();

Application.Run(MyForm);
}

public MainForm()
{
Button MyButton = new Button();

Text = "Button Test";
MyButton.Location = new Point(25, 25);
MyButton.Text = "Click Me";
MyButton.Click += new EventHandler(MyButtonClicked);
Controls.Add(MyButton);
}

public void MyButtonClicked(object sender, EventArgs Arguments)
{
MessageBox.Show("The button has been clicked.");
}
}

0 comments:

Followers

The Daily Puppy

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | JCPenney Coupons