private void TSearch_Click(object sender, EventArgs e) { var search = new TestSearchForm <Test>(guide.Tests); search.ShowDialog(); if (search.DialogResult == DialogResult.Yes) { TestBindingSource.DataSource = search.Searched; if (search.Searched.Count == 0) { MessageBox.Show("К сожалению, ничего не найденo...", "Ошибка"); } } else if (search.DialogResult == DialogResult.No) { TestBindingSource.DataSource = guide.Tests; } TestBindingSource.ResetBindings(false); }
private void Search1ToolStripMenuItem_Click(object sender, EventArgs e) { var search = new TestSearchForm <Question>(test.Questions); search.ShowDialog(); if (search.DialogResult == DialogResult.Yes) { questionsBindingSource.DataSource = search.Searched; if (search.Searched.Count == 0) { MessageBox.Show("К сожалению, ничего не найденo...", "Ошибка"); } } else if (search.DialogResult == DialogResult.No) { questionsBindingSource.DataSource = test.Questions; } questionsBindingSource.ResetBindings(false); }