Hi,
I am new to WinGrid and ultraCalcManager.
I am developing a windwos application in VB.net and using the grid in one of my forms. There are 4 columns in the grid. User enters the amount manually and i would like WinGrid calculates the VAT and the total by using the formula. i have added UltraCalcManager to the form and also writen my math function which is a normal adding.
when i set the grid datasource, i get an error message "NullReferenceException was unhandlled". if i set CalcFrequnecy to Manual, the error message goes away and formula does not work. If I set it to the other options, it throws the above error message.
Could you please help in this matter?
Many thanks
Kamal
Hi Kamal,
It's impossible to guess without more information. Where is the error occurring? Can you post the call stack? What does your formula look like? Whta are you applying the formula to? Is this is a summary or are you putting a formula into a column?
Hi Mike,
I was away for few days, so sorry for not replying back to your questions.
The error occurs when i try to bind data. Initially, the value is zero for all columns. There are 3 columns; Amount, Vat, Total. The user enter a value into Amount column and this formula should fire up to calculate VAT:
(Amount * 17.5) / 100
and this formula is for Total column:
Amount + Vat
I found out that i can not use Formula in the Bind column, so I hidden my bind column and added two unbound column. I am putting the formula into these unbound columns.
thanks for your help.
HI Kamal,
There's really not enough here for me to go on. Perhaps your best option is to create a small sample project which demonstrates the error and Submit an incident to Infragistics Developer Support.
Thanks for your reply. While I am setting up a demo application, could you tell me what is the easiest way to add formula to a cell please? Can I add a formula to a bind column? or should it be unbound column?
Thanks,
I beleive you can add formulas to bound columns. But the column really can't be editable by the user, since the calculated value will overwrite anything the user types into the cell.
The easiest way to add a formula to a grid column is to set the Formula property on the column. You cannot apply a formula to a single cell. And you must have an UltraCalcManager component on the form with the grid.
You should create a small sample project that demonstrates this error and Submit an incident to Infragistics Developer Support
I set the Formula to the column "Total" and the formula is "Amount + Vat". Amount and Vat are two columns in the table and I set the datasource in my code.
this is the StackTrace of the error:
at Infragistics.Win.UltraWinGrid.RefCellCollection.RefCellCollectionEnumerator.MoveNext() at Infragistics.Win.CalcEngine.UltraCalcEngine.RecalcReferences(IUltraCalcReference reference) at Infragistics.Win.CalcEngine.UltraCalcEngine.ProcessTopologicalEvent(QueueInfo item) at Infragistics.Win.CalcEngine.UltraCalcEngine.CleanTopologicalEventQueue(Int64 ticks) at Infragistics.Win.CalcEngine.UltraCalcEngine.Recalc(Int64 ticks) at Infragistics.Win.UltraWinCalcManager.UltraCalcManager.ReCalcInternal(Int64 ticks) at Infragistics.Win.UltraWinCalcManager.UltraCalcManager.ReCalc(Int64 millis) at Infragistics.Win.UltraWinCalcManager.UltraCalcManager.onTimerTick(Object sender, EventArgs e) at System.Windows.Forms.Timer.OnTick(EventArgs e) at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(ApplicationContext context) at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[ commandLine) at Mobex.My.MyApplication.Main(String[ Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[ args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[ args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()