private void ButtonEdit_Click(object sender, EventArgs e) { int rowNo = dataGridViewKako.CurrentCellAddress.Y; FormKakou frmKakou = new FormKakou(); frmKakou.labelTokuisaki.Text = textBoxTokuisaki.Text; frmKakou.labelSeihinCode.Text = textBoxSeihinCode.Text; frmKakou.labelSeihinMei.Text = textBoxSeihinMei.Text; frmKakou.labelBuhinCode.Text = textBoxBuhinCode.Text; frmKakou.labelBuhin.Text = textBoxSiyoTaisyo.Text + " " + textBoxThickness.Text + "T x " + textBoxWidth.Text + " x " + textBoxLength.Text; frmKakou.labelSuryo.Text = "数量 " + textBoxSuryo.Text; string editNo = string.Format("{0}-{1}", toolSSLabelKanriCode.Text, (string)ds.Tables["加工"].Rows[rowNo]["加工コード"]); frmKakou.toolSSLabelKanriCode.Text = this.toolSSLabelKanriCode.Text; frmKakou.toolSSLabelKakouKanriCode.Text = editNo; frmKakou.toolSSLabelSeries.Text = this.toolSSLabelSeries.Text; //順番 frmKakou.labelJunban.Text = (string)ds.Tables["加工"].Rows[rowNo]["順番"].ToString(); //加工コード frmKakou.textBoxKakouNo.Text = (string)ds.Tables["加工"].Rows[rowNo]["加工コード"]; //加工種コード frmKakou.textBoxKakouSyubetuCode.Text = (string)ds.Tables["加工"].Rows[rowNo]["加工種コード"]; //加工種 frmKakou.textBoxKakouSyubetu.Text = (string)ds.Tables["加工"].Rows[rowNo]["加工種"]; //機械コード frmKakou.textBoxKikaiCode.Text = (string)ds.Tables["加工"].Rows[rowNo]["機械コード"]; //機械 frmKakou.textBoxKikai.Text = (string)ds.Tables["加工"].Rows[rowNo]["機械"]; // 作業内容 frmKakou.textBoxNaiyoS.Text = (string)ds.Tables["加工"].Rows[rowNo]["作業内容"]; // 作業詳細 frmKakou.textBoxNaiyoL.Text = (string)ds.Tables["加工"].Rows[rowNo]["作業詳細"]; // NC管理コード frmKakou.textBoxNcCode.Text = (string)ds.Tables["加工"].Rows[rowNo]["NC管理コード"].ToString(); // NCプログラム番号 frmKakou.textBoxNCProgramNo.Text = (string)ds.Tables["加工"].Rows[rowNo]["プログラム番号"].ToString(); // NC取り数 frmKakou.textBoxNCTorisu.Text = (string)ds.Tables["加工"].Rows[rowNo]["NC取り数"].ToString(); // 参照画像1 frmKakou.textBoxGazo1.Text = (string)ds.Tables["加工"].Rows[rowNo]["参照画像1"]; frmKakou.pictureBox1.ImageLocation = frmKakou.textBoxGazo1.Text; // 参照画像2 frmKakou.textBoxGazo2.Text = (string)ds.Tables["加工"].Rows[rowNo]["参照画像2"]; frmKakou.pictureBox2.ImageLocation = frmKakou.textBoxGazo2.Text; // 参照画像3 frmKakou.textBoxGazo3.Text = (string)ds.Tables["加工"].Rows[rowNo]["参照画像3"]; frmKakou.pictureBox3.ImageLocation = frmKakou.textBoxGazo3.Text; if (frmKakou.ShowDialog() == DialogResult.OK) { //順番 ds.Tables["加工"].Rows[rowNo]["順番"] = frmKakou.labelJunban.Text; //加工コード ds.Tables["加工"].Rows[rowNo]["加工コード"] = frmKakou.textBoxKakouNo.Text; //加工種コード ds.Tables["加工"].Rows[rowNo]["加工種コード"] = frmKakou.textBoxKakouSyubetuCode.Text; //加工種 ds.Tables["加工"].Rows[rowNo]["加工種"] = frmKakou.textBoxKakouSyubetu.Text; //機械コード ds.Tables["加工"].Rows[rowNo]["機械コード"] = frmKakou.textBoxKikaiCode.Text; //機械 ds.Tables["加工"].Rows[rowNo]["機械"] = frmKakou.textBoxKikai.Text; // 作業内容 ds.Tables["加工"].Rows[rowNo]["作業内容"] = frmKakou.textBoxNaiyoS.Text; // 作業詳細 ds.Tables["加工"].Rows[rowNo]["作業詳細"] = frmKakou.textBoxNaiyoL.Text; // NC管理コード ds.Tables["加工"].Rows[rowNo]["NC管理コード"] = frmKakou.textBoxNcCode.Text; // NCプログラム番号 ds.Tables["加工"].Rows[rowNo]["プログラム番号"] = frmKakou.textBoxNCProgramNo.Text; // NC取り数 ds.Tables["加工"].Rows[rowNo]["NC取り数"] = frmKakou.textBoxNCTorisu.Text; // 参照画像1 ds.Tables["加工"].Rows[rowNo]["参照画像1"] = frmKakou.textBoxGazo1.Text; // 参照画像2 ds.Tables["加工"].Rows[rowNo]["参照画像2"] = frmKakou.textBoxGazo2.Text; // 参照画像3 ds.Tables["加工"].Rows[rowNo]["参照画像3"] = frmKakou.textBoxGazo3.Text; //DisplayKakou(toolSSLabelKanriCode.Text); } }
private void ButtonAdd_Click(object sender, EventArgs e) { FormKakou frmKakou = new FormKakou(); frmKakou.labelTokuisaki.Text = textBoxTokuisaki.Text; frmKakou.labelSeihinCode.Text = textBoxSeihinCode.Text; frmKakou.labelSeihinMei.Text = textBoxSeihinMei.Text; frmKakou.labelBuhinCode.Text = textBoxBuhinCode.Text; frmKakou.labelBuhin.Text = textBoxSiyoTaisyo.Text + " " + textBoxThickness.Text + "T x " + textBoxWidth.Text + " x " + textBoxLength.Text; frmKakou.labelSuryo.Text = "数量 " + textBoxSuryo.Text; frmKakou.toolSSLabelKanriCode.Text = this.toolSSLabelKanriCode.Text; frmKakou.toolSSLabelKakouKanriCode.Text = ""; frmKakou.toolSSLabelSeries.Text = this.toolSSLabelSeries.Text; //新しい行番号を取得 int rowCnt = 0; int rowNo; rowCnt = dataGridViewKako.BindingContext[dataGridViewKako.DataSource, dataGridViewKako.DataMember].Count; rowNo = rowCnt; rowCnt++; frmKakou.labelJunban.Text = rowCnt.ToString(); if (frmKakou.ShowDialog() == DialogResult.OK) { ds.Tables["加工"].Rows.Add(ds.Tables["加工"].NewRow()); ds.Tables["加工"].Rows[rowNo]["加工管理コード"] = frmKakou.toolSSLabelKakouKanriCode.Text; ds.Tables["加工"].Rows[rowNo]["管理コード"] = frmKakou.toolSSLabelKanriCode.Text; ds.Tables["加工"].Rows[rowNo]["製品コード"] = frmKakou.labelSeihinCode.Text; ds.Tables["加工"].Rows[rowNo]["部品コード"] = frmKakou.labelBuhinCode.Text; //順番 ds.Tables["加工"].Rows[rowNo]["順番"] = frmKakou.labelJunban.Text; //加工コード ds.Tables["加工"].Rows[rowNo]["加工コード"] = frmKakou.textBoxKakouNo.Text; //加工種コード ds.Tables["加工"].Rows[rowNo]["加工種コード"] = frmKakou.textBoxKakouSyubetuCode.Text; //加工種 ds.Tables["加工"].Rows[rowNo]["加工種"] = frmKakou.textBoxKakouSyubetu.Text; //機械コード ds.Tables["加工"].Rows[rowNo]["機械コード"] = frmKakou.textBoxKikaiCode.Text; //機械 ds.Tables["加工"].Rows[rowNo]["機械"] = frmKakou.textBoxKikai.Text; // 作業内容 ds.Tables["加工"].Rows[rowNo]["作業内容"] = frmKakou.textBoxNaiyoS.Text; // 作業詳細 ds.Tables["加工"].Rows[rowNo]["作業詳細"] = frmKakou.textBoxNaiyoL.Text; // NC管理コード ds.Tables["加工"].Rows[rowNo]["NC管理コード"] = frmKakou.textBoxNcCode.Text; // NCプログラム番号 int pn; ds.Tables["加工"].Rows[rowNo]["プログラム番号"] = frmKakou.textBoxNCProgramNo.Text; // NC取り数 ds.Tables["加工"].Rows[rowNo]["NC取り数"] = frmKakou.textBoxNCTorisu.Text; // 参照画像1 ds.Tables["加工"].Rows[rowNo]["参照画像1"] = frmKakou.textBoxGazo1.Text; // 参照画像2 ds.Tables["加工"].Rows[rowNo]["参照画像2"] = frmKakou.textBoxGazo2.Text; // 参照画像3 ds.Tables["加工"].Rows[rowNo]["参照画像3"] = frmKakou.textBoxGazo3.Text; //DisplayKakou(toolSSLabelKanriCode.Text); } }