private void parentForm_Shown(object sender, EventArgs e) { pbxIcon.Image = SystemIcons.Question.ToBitmap(); InitializeApplicationData(); OutputLogFile = (setting.ExportErrorLog == 1); if (OutputLogFile) { cmbLogFilePath.SelectedIndex = setting.ErrorLogDestination; } if (!(ParentForm is BasicForm)) { return; } var buttonName = string.Empty; switch (setting.ImportMode) { case 0: buttonName = "btnF04"; break; case 1: buttonName = "btnF06"; break; case 2: buttonName = "btnF08"; break; } var button = ParentForm.GetAll <Button>() .FirstOrDefault(x => x.Name == buttonName); button?.Focus(); }