private void dgvMeasureItem_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; int i = e.RowIndex; string instrument = dgvMeasureItem.Rows[i].Cells[5].Value.ToString(); int curRow = int.Parse(e.RowIndex.ToString()); string model = cmbModel.Text; string process = dgvMeasureItem["process", i].Value.ToString(); string inspect = dgvMeasureItem["inspect", i].Value.ToString(); string user = txtUser.Text; if (dgvMeasureItem.Rows[i].Cells[4].Selected && cmbModel.Text != "") { if (instrument == "push" || instrument == "pull") { frmPushPull fP = new frmPushPull(); fP.updateControls(model, process, inspect, user, _ip); fP.Show(); } else if (instrument == "hr-20") { frmScale fS = new frmScale(); fS.updateControls(model, process, inspect, user, _ip); fS.Show(); } else if (instrument == "hiohm") { frmHioki fH = new frmHioki(); fH.updateControls(model, process, inspect, user, _ip); fH.Show(); } else { frmManual fM = new frmManual(); fM.updateControls(model, process, inspect, user, _ip); fM.Show(); } } else { MessageBox.Show("Model or line is empty!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }
// グリットビュー上のボタンクリック時、フォーム2・3・4を開く(フォーム2はデレゲートあり) private void dgvBoxId_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (!(senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)) { return; } //選択したボタンに該当する情報を保持する int curRow = int.Parse(e.RowIndex.ToString()); string model = dgvMeasureItem["model", curRow].Value.ToString(); string process = dgvMeasureItem["process", curRow].Value.ToString(); string inspect = dgvMeasureItem["inspect", curRow].Value.ToString(); string instrument = dgvMeasureItem["instrument", curRow].Value.ToString(); string user = txtUser.Text; //測定器に該当するフォームを開く if (instrument == "push" || instrument == "pull") { frmPushPull fP = new frmPushPull(); fP.updateControls(model, process, inspect, user, _ip); fP.Show(); } else if (instrument == "hr-20") { frmScale fS = new frmScale(); fS.updateControls(model, process, inspect, user, _ip); fS.Show(); } else if (instrument == "hiohm") { frmHioki fH = new frmHioki(); fH.updateControls(model, process, inspect, user, _ip); fH.Show(); } else { frmManual fM = new frmManual(); fM.updateControls(model, process, inspect, user, _ip); fM.Show(); } }