Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
pre-defined formulas
posted

Hi,

 I'm trying to produce a column (results) in a dataGridView whose value is calculated from pre-existing formulas, which are located in a separate column (formulas). The formulas, and subsequently results, are different for each row, but the logic should be the same, just use the formula from the 'formula' column to calculate the value for 'result'. The formulas are currently displayed as strings, with the same format as if they had been produced by FormulaBuilder. I've so far had no luck trying to assign the formula column to the 'formula' property of an IFormulaProvider.

Is there any way to do this?

Any help is greatly appreciated!

Thanks,

Joel

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi Joel,

    Just to make sure I understand... you have a DataGridView (not an UltraWinGrid) and you have a column that contains a string which is a formula. And you want to apply that formula to a cell in the same row.

    You cannot apply a formula to an individual cell. So if you are trying to get a different formula in each row based on the string in the other cell, it will not work. 

    But... if you want to apply a formula to a column, you would do it like this: 

    DataGridViewColumnCalcSettings calcSetting = this.ultraCalcManager1.GetColumnCalcSettings(resultsDataGridViewTextBoxColumn);
    calcSetting.Formula = "2+2";

Reply Children