private void btnAddStavka_Click(object sender, EventArgs e) { try { if (!UserControlHelpers.ComboBoxValidation(cbAutomobil, lblAutomobil) | !UserControlHelpers.ComboBoxValidation(cbPolisa, lblPolisa) | !UserControlHelpers.DateRentiranjeValidation(dtpDatumDo, dtpDatumOd, lblDatumDo) ) { return; } stavkaRentiranja = new StavkaRentiranja { RedniBroj = redniBroj, DatumOd = dtpDatumOd.Value, DatumDo = dtpDatumDo.Value, Automobil = (Automobil)cbAutomobil.SelectedItem, Polisa = (Polisa)cbPolisa.SelectedItem }; this.DialogResult = DialogResult.OK; this.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }