我有一個窗戶DataGridView
enter code here
形成,我從數據源產生通過拖放對象到表單中。過濾我的DataGridView
中的行從數據源正確顯示,我希望能夠使用TextBox
通過它們特定的列來過濾他們。
我的綁定源被稱爲「customerBindingSource」。
我嘗試這樣做:
private void _txtFilterEmail_TextChanged(object sender, EventArgs e){
customerBindingSource.DataSource = dataGridView1.DataSource;
customerBindingSource.Filter = dataGridView1.Columns[1].HeaderText.ToString() +
"LIKE '%" + _txtFilterEmail.Text + "%'";
dataGridView1.DataSource = customerBindingSource.DataSource;
}
但是當我鍵入TextBox
的東西,什麼都不會發生。
我是相當新的Windows Forms和的EntityFramework。
在數據源中,headertext與datapropertyname有什麼不同? –
不,我之前測試過,它們是一樣的。 – mockingbid
'dataGridView1.Columns [1] .HeaderText.ToString()+「LIKE「%‘'有前'LIKE' –