public partial class Form1 : Form { BindingSource source; public Form1() { InitializeComponent(); List list = new List(); list.Add(new Source { ID = "1", Name = "c#" }); list.Add(new Source { ID = "2", Name = "JAVA" }); source = new BindingSource(); source.DataSource = list; this.dataGridView1.DataSource = source; }
private void textBox1_TextChanged(object sender, EventArgs e) { source.Filter = " '%" + textBox1.Text.Trim().ToUpper() + "%'"; } } public class Source { public string ID { get; set; } public string Name { get; set; } }
Filter无效。。请问高手为什么??网上查了。必须用datatable或dataset做数据源。。如果非要用list。。。要怎么处理??神人进。。。
添加回答
举报
0/150
提交
取消