private void Button1_Click(object sender, EventArgs e) { InsertOrEdit = "Добавить"; AddingAndEditingAutoParts f = new AddingAndEditingAutoParts(); f.Owner = this; f.ShowDialog(); }
private void Button2_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow != null) { ID_autoparts = Convert.ToInt32(dataGridView1[0, dataGridView1.CurrentRow.Index].Value); Article = dataGridView1[1, dataGridView1.CurrentRow.Index].Value.ToString(); Title = dataGridView1[2, dataGridView1.CurrentRow.Index].Value.ToString(); Brand = dataGridView1[4, dataGridView1.CurrentRow.Index].Value.ToString(); Model = dataGridView1[5, dataGridView1.CurrentRow.Index].Value.ToString(); Manufacturer = dataGridView1[6, dataGridView1.CurrentRow.Index].Value.ToString(); Comment = dataGridView1[8, dataGridView1.CurrentRow.Index].Value.ToString(); InsertOrEdit = "Редактировать"; AddingAndEditingAutoParts f = new AddingAndEditingAutoParts(); f.Owner = this; f.Show(); } else { MessageBox.Show("Не выбрана автозапчасть для редактирования.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }