private void button6_Click(object sender, EventArgs e) { Button button3 = (Button)sender; CarDetailForm form = new CarDetailForm(button3.Text); form.Show(); }
public static void openCar(object sender, EventArgs e) { //Бегаем по всем кнопкам for (int i = 0; i < 6; i++) { //И для нужной открываем форму if (((Button)sender).Text == cars[i].btn.Text) { CarDetailForm form = new CarDetailForm(cars[i]); form.Show(); } } }
private void button2_Click(object sender, EventArgs e) { CarDetailForm form = new CarDetailForm(button2.Text); form.Show(); }