// Sample
using System;
using System.Drawing;
using System.Windows.Forms;
// Simple class used as data source
class Pal
{
int age;
public int Age { // our numerical property
get {
return age;
}
set {
age = value;
}
}
}
public class Test : Form
{
static void Main ()
{
Application.Run (new Test ());
}
public Test ()
{
Pal pal = new Pal ();
TextBox age_box = new TextBox ();
age_box.Location = new Point (5, 5);
age_box.DataBindings.Add (new Binding ("Text", pal, "Age")); // Text property bound to Int32 Pal.Age property
age_box.Parent = this;
// Helper text box, for changing focus
TextBox box = new TextBox ();
box.Location = new Point (5, age_box.Bottom + 5);
box.Parent = this;
}
}