我正在尝试创建数据的可过滤数据视图,我通过 NAV 2009 中的 Web 服务获取它。
我创建了一个 Windows 窗体并从 NAV 页面中提取基本数据,创建了一个数组并使用 Web 服务在 dataGridView 中显示。
我现在需要的是按行过滤我在 dataGridView 中的数据。
我的代码是
private void LoadDataGrid()
{
WS_GLEntry_Service GLEntryService = new WS_GLEntry_Service();
GLEntryService.UseDefaultCredentials = true;
WS_GLEntry[] Entries = GLEntryService.ReadMultiple(null,null,0);
dataGridView1.DataSource = Entries;
(dataGridViewFields.DataSource as DataTable).DefaultView.RowFilter = string.Format("Field = '{0}'", textBox1.Text);
}
但是在包含 dataGridViewFields 的代码的最后一行中,不在上下文中。如果我想修改我的编码我应该怎么做?
谢谢你。