private void OpenButton_Click(object sender, EventArgs e) { var result = OpenDatabaseDialog.ShowDialog(this); if (result == DialogResult.OK && File.Exists(OpenDatabaseDialog.FileName)) { var writer = new StringWriter(); try { _databaseManager = new SiedleDatabaseManager(OpenDatabaseDialog.FileName, writer); _databaseManager.TrimTexts(); LogTextBox.Text = writer.ToString(); _databaseManager.FixDescriptionTexts(); LogTextBox.Text = writer.ToString(); _databaseManager.CreateMissingCards(); LogTextBox.Text = writer.ToString(); _databaseManager.FindNumberingHoles(); LogTextBox.Text = writer.ToString(); _databaseManager.TestFlagsValidity(); LogTextBox.Text = writer.ToString(); } catch (Exception ex) { writer.WriteLine(ex); LogTextBox.Text = writer.ToString(); } } }
private void project2Button_Click(object sender, EventArgs e) { var result = OpenDatabaseDialog.ShowDialog(this); if (result == DialogResult.OK && File.Exists(OpenDatabaseDialog.FileName)) { project2TextBox.Text = OpenDatabaseDialog.FileName; } }
private void button1_Click(object sender, EventArgs e) { var openDbDialog = new OpenDatabaseDialog(); // Show the form as a dialog and capture the result if (openDbDialog.ShowDialog() == DialogResult.OK) { MessageBox.Show("You clicked 'Ok' to close the dialog"); } else { MessageBox.Show("You closed the dialog some other way"); } }