Articles in this section
Category / Section

How to format the CalcQuick result?

1 min read


By default, the values from the particular key in CalcQuick are returned as an object value. This value can be converted as a string by using ToString() method. As separate support is not provided to format the result of the CalcQuick, the result is formatted as the following suggested way.


To format the result of the CalcQuick calculations, the result can be parsed by using any of the formatting methods. For example,

  1. int.Parse
  2. double.Parse
  3. decimal.Parse


private void calculateBtn_Click(object sender, EventArgs e)
        //Reassigns the key values to the CalcQuick
        calculator["A"] = this.value1Text.Text;
        calculator["B"] = this.value2Text.Text;
        calculator["C"] = this.formulaText.Text;
         //Used to recalculate the all formulas in CalcQuick
          //Formats the result string after parsed as double
          this.resultText.Text = double.Parse(calculator["C"].ToString()).ToString("#,##0.00");



Private Sub calculateBtn_Click(ByVal sender As Object, ByVal e As EventArgs) Handles calculateBtn.Click
    'Reassigns the formula if changed
     calculator("A") = Me.value1Text.Text
     calculator("B") = Me.value2Text.Text
     calculator("C") = Me.formulaText.Text    
    'Used to recalculate the all formulas in CalcQuick
     'Formats the result string after parsed as double
      Me.resultText.Text = Double.Parse(calculator("C").ToString()).ToString("#,##0.00")
End Sub



The SetDirty() method is used for every calculations. I.e. whenever you are calculating the formulas with different values.


Refer to the following screenshot.

Showing formatted result in WinForms Calculation Engine

Sample Links:

C#: Formatting_Results_CalcQuick_CS

VB: Formatting_Results_CalcQuick_VB

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment