How To Calculate String That Has Formula
Sep 27, 2010It's possible to calculate a string that has a formula something like:
dim val as integer
dim formula as string = "(5/1.5) + 10"
val = formula
And the result should be 13.33
It's possible to calculate a string that has a formula something like:
dim val as integer
dim formula as string = "(5/1.5) + 10"
val = formula
And the result should be 13.33
I have a text box for user key in a formula,like '1+3-5',and i need to solve and display the answer.
Also need to handle the brackets,like '9+(2*4)'.
Operation is plus,minus,multiply,devide.
I use the following columns stored in a SQL table called tb_player:
Date of Birth (Date), Times Played (Integer), Versions (Integer)
to calculate a "playvalue" (integer) in the following formula:
playvalue = (Today - Date of Birth) * Times Played * Versions
I display upto 100 of these records with the associataed playvalue on a webpage at any time.
My question is, what is the most efficient way of calculating this playvalue given it will change only once a day, due to the (today-date of birth) changing? The other values (times played & versions) remain the same.
Is there a better way than calculating this on the fly each time for the 100 records? If so, is it more efficient to do the calculation in a stored proc or in VB.NET/C#?
Using VB.Net (Windows Application)[cod]e...
f1 = a + b * c means i have to pass the value a = textbox1.text, b= textbox2.text, c = textbox3.text
I have the following columns : (Using Excel Formula)
A B
------------------------
1 | Date | Value |
------------------------
2 | 8/20/2011 | 92.8 |
3 | 8/21/2011 | 92.4 |
[code]....
I want to calculate the difference between 1st Value (B2) and last Value (last populated row in column B)
Edited :
Using formula : =B2-B6 is not what's required. (I want diff in Cell C2)
I want when the user enters the value in B7 it automatically shows the difference between B2 and B7, when he populates B8 then it shows the diff between B2 and B8 and so on.. I don't want some direct method to do this in Excel and not by iterating all values to check the last value.
I have made calculator in visual basic that can calculate the costs of products. You first select the type of product. Then you insert the dimensions. After that it calculates de costs. The type op products are stored in a Access database. In this database is stored a formula as a string. The problem is that i can't caculate the selected string with the formula and the given dimensions.
View 10 RepliesIn the user input of a textbox I would like that the user can input a formula to make it easier for him. So instead of inputing 400 I would like the user to have the possibility to input as 8*50. Is there a command for vb2008 to calculate the answer of this formula inputed by a string ?
View 2 RepliesI have a question about storing formulas on a database and bringing them back in as a string. I want to have the user enter in a width and that number will be passed to intWidth. Lets say a user enters 8 into txtWidth, strRange will = "Less Than 10" and in the database I will have a Width_Range column with "Less Than 10" and a corresponding Equation column to go with it. If I have a formula such as (1800 * 1.8) saved in that database column, the code I have works and does the calculation.
[Code]...
The string itself contains things like "random" & random.next(1,3) & "random2" etc. The string registers all of this as a string and doesn't actually calculate random numbers.Is there any way to fix this?
View 8 RepliesI want to place two radio buttons in so I can select one of them to use one formula, and then select the other to use another formula. I want to use the I=P(1+r)^n formula and I=P(1-r)^n formula with the radio button text showing Appreciation and Depreciation.
Heres my copy of the original code.
Public Class Form1
Private Sub cmdExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExit.Click
End
End Sub
[CODE].......................
Is there a method to calculate an equation from a string that looks something like "(1 + 1) * 2"?
View 9 RepliesIs there a method to calculate an equation from a string that looks something like "(1 + 1) * 2"?
View 2 RepliesI have the following hex string 40 50 4C 41 59 0D I am transmitting to a piece of equipment, I need to calculate a checksum value to add to the string as the last byte to be sent. The checksum byte is generated in such a manner that the result of addition of all bytes of a message will become 11111111(255). the code that you see here does not work can anyone tell/show me why? Whats important is the checksum calculation.
[Code]...
I can't seem to get my Calculator off the ground. It seems so damn easy to make an application that can enter text into a Textbox, I can't seem to get the damn thing to calculate a value, ... I can do this very easily if I don't have any buttons or textboxes, I can calculate any number I like, ...
Simple Example, Put Imports System.Math at the Top.
[Code]...
does anyone know how to calculate a textbox string to be a CRC16 value?
View 7 RepliesI am trying to calculate the number of years for my calculate age event handler, however i am apparently missing a method or whatnot because im trying to calculate the age , can anyone suggest help on this. I need to subtract years to get my age but when i try the birthdate.Subtract (currentDate) method i get an error about not able to convert from LONG?
So below is what I have.
Private Sub btnCalculateAge_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculateAge.Click
Dim currentDate As Date
Dim BirthDate As Date
Dim Age As Long
[CODE]
how to convert string to datetime and calculate date
View 3 Repliescheck the attached 2 file. one is .docs file another is .bmp file. Problem is that i want add that formula in database through vb.net. what will be data type in sql serve? and how to manage in vb.net??
View 1 RepliesI am reproducing a program written in C to vb.net and I am getting different results on a math formula. I am sure it is something simple that I am overlooking. Here is the formula in C
num = (10 * 9 * 80900 * 0501) & 0xffff;
Here is the same formula in vb.net
num = (10 * 9 * 80900 * 0501) AND &HFF
how to generate the formula. want to use arraylist to store and for loops to loop the formula til the system can detect which staff it should giv the ticket to..below is the scenario:this is a helpdesk system..so each ticket they submit muz be auto assigned to a staff to attend their ticket..each staff has a different quota..so i came out wid this algorithm on hw to determine who the ticket shld go to..
for ex: i set one ticket's quota is 7%
staff A's quota - 47% staff B's quota - 35% staff C's quota - 18% so to knw how many tickets A get den B getx 1 ticket and how many tickets B get den C gets 1i came out wid a calculation like this -
Staff A - 47% / 7% = 6.7(max no.of tickets he can receive foe a period of time)
Staff B - 35% / 7% = 5
Staff C - 18% / 7% = 2.5
so first i compare A&B whr i took 6.7/5 = 1.3 -> so every 1.3 ticket A gets,B gets 1 ticket den i compare B&C whr i took 5/2.5 = 2 -> so every 2 ticket B gets,C gets 1 ticket i wanna implement this concept in my code..but i dunno how to come up wid this formula..
First the requirements: By management requirements, I can't use open source code. I need the users to define their own formulas for a project. My users don't know how to code. The formulas need to be saved somehow, and being read later. I need to debug the formulas written, so I need to be able to see and understand them. The formulas used are quite specialized and specific (actuarial formulas). Adding new formulas (functionality) must be done in fast and maintainable way.
[Code].....
I need a code that will convert decimal to binary. My current code doesn't work and just crashes, any suggestions on what I should do
For i = 1 To 17
Me.lstDec.Items.Add(i)
[code].....
I have a formula, found in an Excel sheet that I have to convert to vb.net...I can't figure it out, eventhough it's seems a quite easy formula to me.the formula is: Mod(X + Int(Y/100000);20)In fact if I render some values...and use the Mod function in Excel or in VB.NET it gives me other results.
View 2 RepliesI'm trying to create a calculator that does this formula : Amount=Principal*(1+InterestRate) The point of it is to Calculate the compound interest earned over however many years the user selects between 1-15 from a listbox. The user also inputs the investment & interest rate. When calculate is clicked the results show in another listbox below.
year 1 $$$$$$
year 2 $$$$$$
etc
[Code]....
I stopped the code at Year 2 as it repeats the ElseIf to EndIf unitl selectedIndex = 15 & intYear 16.
it works for Year 1 but the problem comes with Year 2-15. it needs to take the value from the previous result in lstOutput and use it in the formula for principle.
I have created crystal report for billing summary purpose in windows application.I have sorted out my data on billdate. now i want to claculate subtotal on datewise in crystal report then how to write the formula for that.
View 3 RepliesI want to write a formula to SUM from column B4 to M4, this should be done using vb.net programming.
I tried using the following stuff:
oXLWsheet.Range(4, 14).Formula = "=SUM(oXLWsheet!$B$4:M$4)"
"=SUM(B4:M4)"
"=SUM(B4,C4,D4,E4,F4,G4,H4,I4,J4,K4,L4,M4)"
Nothing is working for me. I'm getting the following error when I run the code:
"Exception from HRESULT: 0x800A03EC".
I want to create an algorithm or formula that gives me the following combinations below. I have manually printed out all the combinations for the example containing 4 tables with respective values.
This is not permutation because i need the combinations to always follow the unique format [code]...
I am using Crystal Report 10.5.3700.0. I have created a report which is using stored procedure. Now from vb.net code (in VS2005) I set the selection formula like: proSaleByPerson;1.PersonsId=1
But when the report load its giving following error "Query Engine Error 'ADO Error Code:0x'", Failed to open a rowset. Keep in mind that all other reports are working fine only that reports creat problem which are using stored procedure, when setting the selection formula.
i have a problem with my crystal reports selection formula, i have two forms form1 and form 2. in form 1 i have combobox where you can select the values to appear in form2 crystal report viewer but when i run form1 and select an item from dropdownlist visual studio throws an error this my selection formula "{StaffInformation.Specialty} LIKE '" & Form1.combobox1.text & "'"
View 1 RepliesI'm creating a Macro for reporting purposes and trying to create a formula that will look at a prior days report, save it out, and work off of that one.
View 2 Replies