Thursday, August 27, 2009

Windows Programming - Add Message Box

using System;
using System.Windows.Forms;
using System.Drawing;
class myfrm : Form
{
Button b;
public myfrm()
{
b = new Button();
b.SetBounds(100, 100, 150, 50);
b.Text = "Ok";
this.Controls.Add(b);
b.Click +=new EventHandler(fun);
}
void fun(object o,EventArgs e)
{
MessageBox.Show("text", "caption");
}
}
class Program
{
static void Main(string[] args)
{
myfrm f = new myfrm();
f.ShowDialog();
}
}

No comments:

Post a Comment