private void addRentBtn_Click(object sender, EventArgs e) { Rent rent = new Rent(); NewRentForm newOrderForm = new NewRentForm(rent); if (newOrderForm.ShowDialog() == DialogResult.OK) { rents.Add(rent); rentsListBox.Items.Add(rent); shortInfoListBox.Items.Add(rent.ToShortString()); } }
private void editRentBtn_Click(object sender, EventArgs e) { if (!IsSelectedOneRent()) { return; } NewRentForm newOrderForm = new NewRentForm(rents[currentListBoxItemIndex]); if (newOrderForm.ShowDialog() == DialogResult.OK) { rentsListBox.Items[currentListBoxItemIndex] = rents[currentListBoxItemIndex]; shortInfoListBox.Items[currentListBoxItemIndex] = rents[currentListBoxItemIndex].ToShortString(); } }