日期:2014-05-17 浏览次数:21176 次
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace testBindingList
{
public partial class Form1 : Form
{
//实例化一个BindingList
BindingList<aaa> lst=new BindingList<aaa>();
public Form1()
{
InitializeComponent();
dataGridView1.AutoGenerateColumns=false;
lst.Add(new aaa("a111","b222"));
lst.Add(new aaa("c333", "d444"));
dataGridView1.DataSource = lst;
}
}
public class aaa
{
string s1;
string s2;
public aaa(string a,string b)
{
s1 = a;
s2 = b;
}
public string qqq
{
get
{
return s1;
}
}
public string www
{
get
{
return s2;
}
}
}
}