private void btnNovy_Click(object sender, EventArgs e) { FormEditUkol form = new FormEditUkol(); DialogResult result = form.ShowDialog(); if (result == DialogResult.OK) { Ukol ukol = new Ukol(form.dtpDatum.Value, form.cbDulezity.Checked, form.cbUpozorneni.Checked, form.tbUkol.Text); PridejUkol(ukol); ZobrazUkoly(); } }
private void BtnEdit_Click(object sender, EventArgs e) { FormEditUkol form = new FormEditUkol(); int idx = SelectedIndex(); if ((idx >= 0) && (idx < ukolList.Count)) { form.dtpDatum.Value = ukolList[idx].Datum; form.cbDulezity.Checked = ukolList[idx].Dulezity; form.cbUpozorneni.Checked = ukolList[idx].Upozorneni; form.tbUkol.Text = ukolList[idx].Text; DialogResult result = form.ShowDialog(); if (result == DialogResult.OK) { Ukol ukol = new Ukol(form.dtpDatum.Value, form.cbDulezity.Checked, form.cbUpozorneni.Checked, form.tbUkol.Text); UpravUkol(idx, ukol); ZobrazUkoly(); } } }