//Script.NET examples
//(c)2007-2009, Protsyk Petro, http://www.protsyk.com

//Disable automatic event clearing
RuntimeHost.SetSettingItem(
   "UnsubscribeAllEvents",
   false);

form = new Form();
form.Width = 200;
form.Height = 200;

//Button Event
function button_event(o, e)
{
  MessageBox.Show('Hi there!');
}

//Timer Event
function time_now(o,e)
{
 o.Tag.Text = DateTime.Now.ToString();
}

Timer1 = new System.Windows.Forms.Timer();
Timer1.Interval = 200;
Timer1.Tick+= time_now;
Timer1.Tag = form;

//Create Button
b = new Button();
b.Width = 100; b.Height = 30;
b.Top = 15; b.Left = 15;
b.Text = 'Hello';
b.Click += button_event;

//Add controls to the Form
form.Controls.Add(b);
form.Show();

Timer1.Enabled = true;