14 Temmuz 2013 Pazar

C# - DataGrid - Binding

private void frmDGV_Load(object sender, EventArgs e)
{
    //dummy data
    List lstStaff = new List();
    lstStaff.Add(new Staff()
    {
        ID = 1,
        Name = "XX"
    });
    lstStaff.Add(new Staff()
    {
        ID = 2,
        Name = "YY"
    });

    
    BindingSource binding = new BindingSource();
    binding.DataSource = lstStaff;

    dataGridView1.DataSource = binding;
}


Hiç yorum yok: