private void aggiungiToolStripMenuItem1_Click(object sender, EventArgs e) { AddDestinatarioForm adf = new AddDestinatarioForm(); DialogResult dr = adf.ShowDialog(); if (dr == DialogResult.OK) { dag.salvaDestinatario(adf.piva, adf.nome, adf.sede, adf.descr); } }
private void btnAddDest_Click(object sender, EventArgs e) { AddDestinatarioForm adf = new AddDestinatarioForm(); DialogResult dr = adf.ShowDialog(); if (dr == DialogResult.OK) { dag.salvaDestinatario(adf.piva, adf.nome, adf.sede, adf.descr); dropDest.Items.Clear(); ddt = dta.GetDataOrderByNome(); int itemToSelect = 0; for (int i = 0; i < ddt.Count; i++) { if (ddt[i]["Nome"].ToString() == adf.nome) itemToSelect = i; dropDest.Items.Add(new DestinatarioDropDownItem(int.Parse(ddt[i]["ID"].ToString()), ddt[i]["Nome"].ToString())); } dropDest.SelectedIndex = itemToSelect; } }