/// <summary> /// Invokes the expression editor. /// </summary> /// <param name="report">A reference to the report.</param> /// <param name="expression">The expression to edit.</param> /// <returns>The new expression.</returns> public static string EditExpression(Report report, string expression) { using (ExpressionEditorForm form = new ExpressionEditorForm(report)) { form.ExpressionText = expression; if (form.ShowDialog() == DialogResult.OK) { return(form.ExpressionText); } } return(expression); }
private void OpenExpressionEditorDialog(string columnName) { _columnName = columnName; if (_dialog == null) { _dialog = new ExpressionEditorForm(); _dialog.Apply += _dialog_Apply; } // set data for ExpressionEditorForm dialog _dialog.Text = string.Format("Edit expression of '{0}' column", columnName); _dialog.DataSource = dataGridView1.DataSource; _dialog.Expression = dataGridView1.GetExpression(columnName); _dialog.ShowDialog(); if (_dialog.DialogResult == DialogResult.OK) { // update expression and evaluate it dataGridView1.UpdateExpression(columnName, _dialog.Expression); dataGridView1.Evaluate(columnName); } }