private void ShowCommentButton_Click(object sender, EventArgs e) { try { Tram tram = (Tram)vehicle[Convert.ToInt32(CommentnumericUpDown2.Value) - 1]; InfoTextBox.Text += tram.ShowComment() + Environment.NewLine; } catch { MessageBox.Show("Проверьте корректность данных."); } }
private void AddButton_Click(object sender, EventArgs e) { try { IVehicle veh = new Tram(NameTextBox.Text, Convert.ToInt32(YearTextBox.Text), Convert.ToInt32(CostTextBox.Text), Convert.ToInt32(CapTextBox.Text)); vehicle.Add(veh); } catch { MessageBox.Show("Проверьте корректность данных."); } }
private void AddCommentButton_Click(object sender, EventArgs e) { try { Tram tram = (Tram)vehicle[Convert.ToInt32(CommentnumericUpDown2.Value) - 1]; tram.AddComment(CommentTextBox.Text); vehicle[Convert.ToInt32(CommentnumericUpDown2.Value) - 1] = tram; } catch { MessageBox.Show("Проверьте корректность данных."); } }