我已經使用函數Find Text創建了搜索表單,如何保存上次搜索,以便在表單重新打開時創建Find Again按鈕?如何在WinForm上保存搜索
我的搜索代碼:
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.");
}
}