We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Calculate Sample Broken

Thread ID:

Created:

Updated:

Platform:

Replies:

33449 Aug 19,2005 06:22 PM UTC Aug 20,2005 02:06 AM UTC WinForms 2
loading
Tags: Calculate
Derek Price
Asked On August 19, 2005 06:22 PM UTC

I can''t seem to figure out how to use the Calculate engine in the "First Sample" project: C:\Program Files\Syncfusion\Essential Studio\3.2.1.0\Windows\Calculate.Windows\Samples\FirstSample This only concerns the C# project since the VB.NET version does not include the "Algebraic Expressions" button option. When launching the "Algebraic Expressions" form, there is a default equation of "sqrt(2) * 2". Pressing Compute gives the correct answer. Now if I add a variable "b" when a value of 4, adjust the equation to "sqrt(2) * 2 * b", I get an exception with this message: invalid characters following an operator. See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.ArgumentException: invalid characters following an operator at Syncfusion.Calculate.CalcEngine.ParseSimple(String text, Char[] markers, Char[] operators, Boolean& needToContinue) at Syncfusion.Calculate.CalcEngine.ParseSimple(String text) at Syncfusion.Calculate.CalcEngine.Parse(String text) at Syncfusion.Calculate.CalcEngine.ParseAndComputeFormula(String formula) at Syncfusion.Calculate.CalcQuick.ParseAndCompute(String formulaText) at FirstSample.AlgebraicExpressions.button1_Click(Object sender, EventArgs e) in c:\Program Files\Syncfusion\Essential Studio\3.2.1.0\Windows\Calculate.Windows\Samples\FirstSample\CS\AlgebraicExpressions.cs:line 231 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ************** Loaded Assemblies ************** mscorlib Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.2032 CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll ---------------------------------------- FirstSample Assembly Version: 1.0.2057.23710 Win32 Version: 1.0.2057.23710 CodeBase: file:///c:/Program%20Files/Syncfusion/Essential%20Studio/3.2.1.0/Windows/Calculate.Windows/Samples/FirstSample/CS/bin/Debug/FirstSample.exe ---------------------------------------- System.Windows.Forms Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.2032 CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll ---------------------------------------- System Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.2032 CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll ---------------------------------------- System.Drawing Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.2032 CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll ---------------------------------------- System.Xml Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.2032 CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll ---------------------------------------- Syncfusion.Calculate.Base Assembly Version: 3.201.1.0 Win32 Version: 3.201.1.0 CodeBase: file:///c:/windows/assembly/gac/syncfusion.calculate.base/3.201.1.0__3d67ed1f87d44c89/syncfusion.calculate.base.dll ---------------------------------------- Syncfusion.Core Assembly Version: 3.201.1.0 Win32 Version: 3.201.1.0 CodeBase: file:///c:/windows/assembly/gac/syncfusion.core/3.201.1.0__632609b4d040f6b4/syncfusion.core.dll ---------------------------------------- ************** JIT Debugging ************** To enable just in time (JIT) debugging, the config file for this application or machine (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled. For example: When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the machine rather than being handled by this dialog. What am I missing here? Shouldn''t I be able to add a variable and solve for the new equation? Thanks, Derek

Administrator [Syncfusion]
Replied On August 19, 2005 08:45 PM UTC

Nevermind. I figured out you need to surround the variable "b" like this "[b]" to get it recognized. This seems like a hack to get around the variable parsing.

Administrator [Syncfusion]
Replied On August 20, 2005 02:06 AM UTC

The square bracket syntax is the same syntax used in SQL and DataColumn.Expressions. That is the reason we chose to use it in the CalQuick object. It is not used in the CalcEngine class itself. In version 3.2.1, we exposed the underlying engine in the CalQuick object. This allows you to add NamedRanges (which can be more or less anything) that are recognized by the engine''s parser. So, for example, if you want b to be parseable (and not have to use [b]), then you can register b with the engine and set its value using: calculator.Engine.AddNamedRange("b","144"); . If you do this before you try to ParseAndCompute the formula 2 * SQRT(2) * b, then it should work for you.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;