private void stringToolStripMenuItem_Click(object sender, EventArgs e) { using (var dlg = new PatternSearchDialog()) { if (dlg.ShowDialog() == DialogResult.OK) { PopulateSearchResults(dlg.CreateStringSearcher()); } } }