private void btnOK_Click(object sender, EventArgs e)
    {
      if (_oValue == null)
      {
        _oValue = new ConfigurationValue();
      }

      _oValue.ObjectType = (ConfigurationValue.Type)cmbType.SelectedItem;

      switch ((ConfigurationValue.Type)_oValue.ObjectType)
      {
        case ConfigurationValue.Type.Text:
          TextBox txtValue = (TextBox)pnlContent.Controls.Find("txtValue",false)[0];
          _oValue.Value = txtValue.Text;
          break;
      }
    }
    public DialogResult Show(ref ConfigurationValue oValue)
    {
      _oValue = oValue;
      
      foreach (ConfigurationValue.Type oType in Enum.GetValues(typeof(ConfigurationValue.Type)))
      {
        cmbType.Items.Add(oType);
      }

      cmbType.SelectedItem = _oValue == null ? ConfigurationValue.Type.Text : _oValue.ObjectType;

      DialogResult oDialogResult = ShowDialog();
      if (oDialogResult == System.Windows.Forms.DialogResult.OK)
      {
        oValue = _oValue;
      }

      return oDialogResult;
    }
    public static void SetValue(string[] Keys, object Value)
    {
      if (_oData == null)
      {
        Load();
      }

      if (Keys.Length > _iKeyCount)
      {
        throw new Exception("Parameter count exceeds key count.");
      }

      List<string> oKeys = Keys.ToList<string>();
      while (oKeys.Count < _iKeyCount)
      {
        oKeys.Add("");
      }

      // Set the values
      var results = from oRow in _oData.AsEnumerable()
                    where oRow.Field<string>("KEY1") == oKeys[0]
                      && oRow.Field<string>("KEY2") == oKeys[1]
                      && oRow.Field<string>("KEY3") == oKeys[2]
                      && oRow.Field<string>("KEY4") == oKeys[3]
                      && oRow.Field<string>("KEY5") == oKeys[4]
                      && oRow.Field<string>("KEY6") == oKeys[5]
                      && oRow.Field<string>("KEY7") == oKeys[6]
                      && oRow.Field<string>("KEY8") == oKeys[7]
                    select oRow;

      if (!results.Any())
      {
        return;
      }

      DataTable oData = results.CopyToDataTable();

      if (oData.Rows.Count == 0)
      {
        DataRow oRow = oData.NewRow();
        oRow["KEY1"] = oKeys[0];
        oRow["KEY2"] = oKeys[1];
        oRow["KEY3"] = oKeys[2];
        oRow["KEY4"] = oKeys[3];
        oRow["KEY5"] = oKeys[4];
        oRow["KEY6"] = oKeys[5];
        oRow["KEY7"] = oKeys[6];
        oRow["KEY8"] = oKeys[7];
        oRow["VALUE"] = Value;

        _oData.Rows.Add(oRow);
      }

      if (oData.Rows.Count == 1)
      {
        ConfigurationValue oValue = new ConfigurationValue();
        oValue.ObjectType = ConfigurationValue.Type.Text;
        oValue.Value = Value;
        oData.Rows[0]["VALUE"] = Helper.Serialize(oValue);
      }
      else
      {
        throw new Exception("Duplicate configuration settings found.");
      }

      Save(oData);
    }