我创建了一个带有查找文本功能的搜索表单,如何保存上次搜索,以便在重新打开表单时创建一个再次查找按钮?
我的搜索代码是:
private void btnSearch_Click(object sender, EventArgs e)
{
if (cboField.SelectedIndex == -1)
{
return;
}
if (txtValue.TextLength == 0)
{
return;
}
string filter;
filter = "[" + cboField.Text + "]";
filter += lblOperation.Text + "'" + txtValue.Text + "'";
try
{
peopleBindingSource.Filter = filter;
}
catch (System.Data.EvaluateException)
{
MessageBox.Show("Please enter valid values in your text fields.");
}
}