private void воридотToolStripMenuItem_Click(object sender, EventArgs e) { AddForm = new Add_Edit_Form(); //вызываем form для добавление AddForm.Owner = this; //уточняем родитель для обмена между формами AddForm.Text = "Воридот"; AddForm.customer_type_cbx.SelectedIndex = AddForm.product_type_cbx.SelectedIndex = AddForm.realize_type_cbx.SelectedIndex = 0; AddForm.ShowDialog(); }
private void таъғиротToolStripMenuItem_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow == null) { return; } indexRow = -1; //инициализация поле indexRow т.е. индекс текущей строки датаГрида try { indexRow = this.dataGridView1.CurrentRow.Index; } catch { }//if focus=null if (indexRow < 0) { return; } //вызываем form для измененние EditForm = new Add_Edit_Form(); EditForm.Owner = this;//уточняем родитель для обмена между формами EditForm.Text = "Таъғирот"; EditForm.num_txt.Text = this.dataGridView1.Rows[indexRow].Cells["num"].Value.ToString().Trim(); EditForm.customer_type_cbx.SelectedIndex = Convert.ToInt32(this.dataGridView1.Rows[indexRow].Cells["customer_type"].Value); EditForm.fio_txt.Text = this.dataGridView1.Rows[indexRow].Cells["fio"].Value.ToString().Trim(); EditForm.company_txt.Text = this.dataGridView1.Rows[indexRow].Cells["company"].Value.ToString().Trim(); EditForm.address_txt.Text = this.dataGridView1.Rows[indexRow].Cells["address"].Value.ToString().Trim(); EditForm.passport_txt.Text = this.dataGridView1.Rows[indexRow].Cells["passport"].Value.ToString().Trim(); EditForm.phone_txt.Text = this.dataGridView1.Rows[indexRow].Cells["phone"].Value.ToString().Trim(); EditForm.product_type_cbx.SelectedItem = this.dataGridView1.Rows[indexRow].Cells["product_type"].Value.ToString().Trim(); EditForm.realize_type_cbx.SelectedItem = this.dataGridView1.Rows[indexRow].Cells["realize_type"].Value.ToString().Trim(); EditForm.pricetxt.Text = this.dataGridView1.Rows[indexRow].Cells["price"].Value.ToString().Trim(); EditForm.checkBox1.Checked = (bool)this.dataGridView1.Rows[indexRow].Cells["withUpdate"].Value; EditForm.textBox_ИНН.Text = this.dataGridView1.Rows[indexRow].Cells["инн"].Value.ToString().Trim(); EditForm.textBox_МФО.Text = this.dataGridView1.Rows[indexRow].Cells["мфо"].Value.ToString().Trim(); EditForm.textBox_ХК.Text = this.dataGridView1.Rows[indexRow].Cells["хк"].Value.ToString().Trim(); EditForm.textBox_СХ.Text = this.dataGridView1.Rows[indexRow].Cells["сх"].Value.ToString().Trim(); EditForm.textBox_банк.Text = this.dataGridView1.Rows[indexRow].Cells["банк"].Value.ToString().Trim(); EditForm.ShowDialog(); }