473,503 Members | 1,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Formula calculation

VJ
We have a form where there is a like 10-15 fields and it performs a length
formula calucation each time field value changes. Using validate event is
not a option as validate wont fire on Menu click and other events on toolbar
click. Right now we have it Value changed i.e entered into control (close to
a textchange) event. Is there a better way to do this.

Just really curious how excel is doing this really fast for complex
formulas, on cell value changes. One reason the formula evaluator is
complied and not interpeted code as in .NET, but would that be a big
difference maker?

VJ
Apr 6 '07 #1
3 2992
..Net code *is* compiled (unless you are interpreting it yourself).
Personally I would bind the UI to an object model (even if that object-
model was UI specific), and simply update the formula property as
necessary and let the UI re-display it via notification. Actually,
myself I use a bespoke model that allows for notifications (via custom
PropertyDescriptors) to calculated values ala:

[Calculated("PropertyA","PropertyB")]
public int SomeFormula {
get {return PropertyA + SomeFunc(PropertyB);}
}

but that needs a lot of base libs that are too long to post here.
Alternatively, a simple model that implements INotifyPropertyChanged,
and simply fire the formula property when-ever you fire any of the
others...

Marc

Apr 7 '07 #2
(note you can set Bindings to update immediately rather than after
validation; this sounds like what you want)

Apr 7 '07 #3
VJ wrote:
We have a form where there is a like 10-15 fields and it performs a length
formula calucation each time field value changes. Using validate event is
not a option as validate wont fire on Menu click and other events on toolbar
click. Right now we have it Value changed i.e entered into control (close to
a textchange) event. Is there a better way to do this.

Just really curious how excel is doing this really fast for complex
formulas, on cell value changes. One reason the formula evaluator is
complied and not interpeted code as in .NET, but would that be a big
difference maker?
The traditional way is:
1) convert from string to list of opcodes and values
2) convert that from infix to postfix
3) evaluate

If you want to cheat, then call JavaScript Eval function from
your C# code.

Arne
Apr 8 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
13160
by: cowboyboborton | last post by:
Looking for some help here. I've tried to solve this, but I just can't. What I need to know is what formula to use in an excel calculation to complete the following calculation. It's in two...
2
2911
by: alex | last post by:
I need a more advanced formula than just an average for calculating items rating. I have: raitng value is on scale 1 to 10. s - sum of all ratings for an item n - number of rates (votes)
3
5152
by: SiewSa | last post by:
I have come to a situation that I need to use the result of a string variable as a formula for performing calculation. As an example below: Dim X As Integer Dim Y As Integer Dim Result...
3
5089
by: Mike | last post by:
Hi, I have three tables in the following structure (simplified): Table 1: Containing the customers ------------------------------------------------- create table Customers ( int...
8
3225
by: GB | last post by:
Hello, How to calculate value for the following formula (I need C# code): res = (((m+1)(m+2)...(m+(k-1)))/1.2...(k-1)) or more generalized formula is: k-1 __ | | (m+i)
5
39227
by: steve | last post by:
Hi All Not sure if this is the right forum, but I need the formula for calculating the amount of Sales tax (GST) from the tax included price In Australia GST is 10% and the standard formula is...
8
5651
by: grahamhow424 | last post by:
Hi I am trying to figure out how to duplicate a, financial, calculation that uses the caret, Exponentiation. Here's the formula... A = 0.0755 B = 34 C = 50000
1
5921
by: JHaworth | last post by:
Hi, Please could someone point me in the right direction with a formula I am trying to create which will enable me to calculate a Net IRR for a series of data? My Problem: •My formula in...
2
1628
by: =?Utf-8?B?QWxhbg==?= | last post by:
I have a InfoPath form that I need to use an event handler to perform a calculation. The calculation is derived from a excel formula that calculates the second tuesday of the month when the user...
30
5643
by: Barry L. Bond | last post by:
Greetings! I just got a new Peet Brothers Ultimeter 2100 Weather Station. This new one has a way to display the heat index, if you press the "dew point" key twice. Being aware of all the...
0
7199
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7074
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7451
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5572
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5000
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4667
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3161
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.