private void miInCnlProps_Click(object sender, EventArgs e) { FrmInCnlProps frmInCnlProps = new FrmInCnlProps(); FrmTable frmTable = winControl.ActiveForm as FrmTable; if (frmTable != null && frmInCnlProps.ShowInCnlProps(frmTable) == DialogResult.OK) { frmTable.UpdateTable(); } }
/// <summary> /// Cell Value Replacement /// </summary> private bool ReplaceCellVal(ColumnInfo columnInfo, bool match, out bool updated) { var replaced = false; // replacing the value of the current test cell if it satisfies the search conditions var curCell = gridView.CurrentCell; if (columnInfo.IsText && (!match || IsMatched(curCell, txtFind.Text, !chkCaseSensitive.Checked, chkWholeCellOnly.Checked))) { gridView.BeginEdit(false); var txt = gridView.EditingControl as TextBox; if (txt != null) { replaced = true; txt.Text = chkWholeCellOnly.Checked ? txtReplaceWith.Text : ReplaceStr(txt.Text, txtFind.Text, txtReplaceWith.Text, !chkCaseSensitive.Checked); } } // replacing the value of the current cell with the list if it satisfies the search conditions if (!columnInfo.IsText && (!match || IsMatched(curCell, cbFind.SelectedValue))) { gridView.BeginEdit(false); var cb = gridView.EditingControl as ComboBox; if (cb != null) { replaced = true; // if the specified value does not exist, the exception is not raised cb.SelectedValue = cbReplaceWith.SelectedValue; } } if (replaced) { completeMsg = AppPhrases.FindCompleted; updated = frmTable.UpdateTable(); } else { updated = true; } return(replaced); }
/// <summary> /// Замена значения ячейки /// </summary> private bool ReplaceCellVal(ColumnInfo columnInfo, bool match, out bool updated) { bool replaced = false; // замена значения текущей тестовой ячейки, если она удовлетворяет условиям поиска DataGridViewCell curCell = gridView.CurrentCell; if (columnInfo.IsText && (!match || IsMatched(curCell, txtFind.Text, !chkCaseSensitive.Checked, chkWholeCellOnly.Checked))) { gridView.BeginEdit(false); TextBox txt = gridView.EditingControl as TextBox; if (txt != null) { replaced = true; txt.Text = chkWholeCellOnly.Checked ? txtReplaceWith.Text : ReplaceStr(txt.Text, txtFind.Text, txtReplaceWith.Text, !chkCaseSensitive.Checked); } } // замена значения текущей ячейки со списком, если она удовлетворяет условиям поиска if (!columnInfo.IsText && (!match || IsMatched(curCell, cbFind.SelectedValue))) { gridView.BeginEdit(false); ComboBox cb = gridView.EditingControl as ComboBox; if (cb != null) { replaced = true; // если заданного значения не существует, исключение не вызывается cb.SelectedValue = cbReplaceWith.SelectedValue; } } if (replaced) { completeMsg = AppPhrases.FindCompleted; updated = frmTable.UpdateTable(); } else { updated = true; } return(replaced); }