private void FormMain_Close(object sender, FormClosedEventArgs e) { Filter filter = new Filter(); filter.platform = comboBoxPlatform.SelectedValue == null ? "" : comboBoxPlatform.SelectedValue.ToString(); filter.label = comboBoxLabels.SelectedValue == null ? "" : comboBoxLabels.SelectedValue.ToString(); filter.genre = comboBoxGenre.SelectedValue == null ? "" : comboBoxGenre.SelectedValue.ToString(); filter.publisher = comboBoxPublisher.SelectedValue == null ? "" : comboBoxPublisher.SelectedValue.ToString(); filter.developer = comboBoxDeveloper.SelectedValue == null ? "" : comboBoxDeveloper.SelectedValue.ToString(); filter.year = comboBoxYearReleased.SelectedValue == null ? "" : comboBoxYearReleased.SelectedValue.ToString(); filter.romfile = dataGridView.SelectedRows.Count == 0 ? "" : ((Rom)dataGridView.SelectedRows[0].Tag).FileName; filter.romplatform = dataGridView.SelectedRows.Count == 0 ? "" : ((Rom)dataGridView.SelectedRows[0].Tag).Platform.Name; filter.text = textBoxFilter.Text; filter.textType = comboBoxFilter.SelectedText; filter.favorite = checkBoxFavorite.Checked; filter.arcade = checkBoxArcade.Checked; filter.console = checkBoxConsole.Checked; filter.handheld = checkBoxHandheld.Checked; filter.status = comboBoxStatus.Text; filter.cd = checkBoxCD.Checked; FilterFunctions.SaveFilter(filter); }