void MainWindow_FileOpened(object sender, KeePass.Forms.FileOpenedEventArgs e) { Debug.WriteLine("File opened"); //add a new Controller for the opened Database SearchController searchCcontroller = new SearchController(this.qsControl, e.Database, GetMainListViewControl()); dictionary.Add(e.Database, searchCcontroller); //assuming the opened Database is also the active Database we subscribe it's SearchController //so user input will be handled by that Controller qsControl.TextChanged += searchCcontroller.TextUpdateHandler; //qsControl.comboBoxSearch.TextChanged += searchCcontroller.TextUpdateHandler; this.qsControl.Enabled = true; if (Settings.Default.FocusOnOpen) { // focus doesn't work if the Form is not yet visible. Use Select instead this.qsControl.comboBoxSearch.Select(); //this.qsControl.comboBoxSearch.Focus(); } }