public Form2(Form1 fr1, Autopark autopark, List<AbstractTransport> transport, int selectedIndex) { InitializeComponent(); this.Text = "Редактирование маршрута"; form1 = fr1; transport1 = transport; autopark1 = autopark; button1.Visible = false; comboBox1.Visible = false; label1.Visible = false; Label[] labelBox = { label2, label3, label4, label5, label6, label7, label8, label9, label10, label11, label12, label13 }; TextBox[] textBoxBox = { textBox1, textBox2, textBox3, textBox4, textBox5, textBox6, textBox7, textBox8, textBox9, textBox10, textBox11, textBox12 }; for (int i = 0; i < 12; i++) { labelBox[i].Visible = false; textBoxBox[i].Visible = false; } route = transport[selectedIndex]; if (route != null) { label2.Visible = true; label3.Visible = true; label4.Visible = true; textBox1.Visible = true; textBox2.Visible = true; textBox3.Visible = true; textBox1.Text = route.Name; textBox2.Text = route.Way; textBox3.Text = Convert.ToString(route.Price); } }
public void AddTransport(AbstractTransport route) { if (transport == null) { transport = new List<AbstractTransport>(); } transport.Add(route); }