void dlg_TextFound(object sender, EventArgs e) { // Get the find dialog box that raised the event FindDialogBox dlg = (FindDialogBox)sender; // Get find results and select found text this.documentTextBox.Select(dlg.Index, dlg.Length); this.documentTextBox.Focus(); }
void editFindMenuItem_Click(object sender, RoutedEventArgs e) { // Instantiate the dialog box FindDialogBox dlg = new FindDialogBox(this.documentTextBox); // Configure the dialog box dlg.Owner = this; dlg.TextFound += new TextFoundEventHandler(dlg_TextFound); // Open the dialog box modally dlg.Show(); }