问题描述
- datagridview的databinding
-
datagridview使用databingdings.add方法为什么不好使?必须使用datasource吗?public Form1() { InitializeComponent(); t1 = new test() { id = "1", name = "a" }; source = new List<test>(); source.Add(new test() { id = "1", name = "a" }); source.Add(new test() { id = "1", name = "1" }); source.Add(new test() { id = "1", name = "1" }); this.dataGridView1.DataBindings.Add("DataSource", this, "source", false, DataSourceUpdateMode.OnPropertyChanged); this.textBox1.DataBindings.Add("Text", t1, "name", false, DataSourceUpdateMode.OnPropertyChanged); //this.dataGridView1.DataSource = source; }
解决方案
DataGrid / DataGridView DataBinding
DataBinding
解决方案二:
楼上说的不对啊,我问的是为什么不能像
textBox1.DataBindings.Add ( "Text" , dsDataSet1, " Customers.CustomerID " ) ;
这样,把datagridview绑定到一个list
时间: 2025-01-29 15:52:41