private void GenerateXmlButtonHandler(object sender, EventArgs e) { try { TravelAgencyDbContext dbContext = new TravelAgencyDbContext(); XMLGenerator xmlGenerator = new XMLGenerator(); var cb1Value = this.destinationsComboBox.SelectedValue.ToString(); var cb2Value = this.guidesComboBox.SelectedValue.ToString(); var cb3Value = this.transportsComboBox.SelectedValue.ToString(); xmlGenerator.XmlGenerate(dbContext, cb1Value, cb2Value, cb3Value); MessageBox.Show("XML document was generated successfully with the data from SQL!"); } catch (Exception) { MessageBox.Show("XML document couldn't be generated!"); } }