// события с грузовиками private void AddListLorry_Click(object sender, EventArgs e) { Lorry lorry = new Lorry(); lorries.Add(lorry); lorry.SetParams(markLorry.Text, (int)countCylindersLorry.Value, (int)powerLorry.Value); lorry.SetParams((int)capacity.Value); listBoxLorry.Items.Add(lorry.GetParams()); }
private void ChangeLorry_Click(object sender, EventArgs e) { Lorry lorry = new Lorry(); lorries[listBoxLorry.SelectedIndex] = lorry; try { lorry.SetParams(markLorry.Text, (int)countCylindersLorry.Value, (int)powerLorry.Value); lorry.SetParams((int)capacity.Value); listBoxLorry.Items[listBoxLorry.SelectedIndex] = lorry.GetParams(); } catch { MessageBox.Show("Элемент списка не выбран"); } }