private void ButtonOK_Click(object sender, EventArgs e) { try { var record = new ShipParameterRecord.ShipParameterElement(); var sb = new StringBuilder(); foreach (DataGridViewRow row in ParameterView.Rows) { sb.Append(row.Cells[ParameterView_Value.Index].Value + ","); } sb.Remove(sb.Length - 1, 1); record.LoadLine(sb.ToString()); RecordManager.Instance.ShipParameter[record.ShipID] = record; } catch (Exception ex) { MessageBox.Show("パラメータ設定に失敗しました。\r\n" + ex.Message, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error); } Close(); }