Calculate Maths From A String?
May 18, 2009Is 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 9 RepliesIs there a method to calculate an equation from a string that looks something like "(1 + 1) * 2"?
View 2 RepliesI am trying to make a calculator (how original) but I am also trying to make it like a console. I have a textbox in which you enter a command and a list in which the lines appear.
My question is how can I translate the plain text which the user enters i.e 3*(2+4) to a maths command so that VB can display the answer?
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 RepliesTrying to do some Maths in vb and have it all out put in lblCost.text
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Dim decTax As Decimal
Dim decTotal As Decimal
Dim decSubtotal As Decimal
[code]....
To Show "Total Cost inc. VAT & Delivery $233" E.g
I ve done the main main page which includes a button which when pressed will go on the next page etc etc.
The problem that i am facing with is the concept behind creating the main function of the game.
I.e. Once the main screen comes up it will show a formulae eg 3 + 3. After the forumale is shown the user will input the answer and then when they want to go to the next question that click the next button which inturn shows a different question if the answer is correct, if not it will stay on the same forumale. I would also like to add a skip button that will allow the user to skip the question if they cant figure it out.
So yeah my main issue is programming it ( i mean i can add buttons and program them to link to places (and show messages) but that is all lol) .
incase i didnt menmtion earlier, i am using Visual Basic 2005
i have two textboxes where a numeric value will get entered into both, these values will then be taken and the first value divided by the second value. The problem i am having is that if for example the first value is 11 and the second value is 10, when i divide 11 by 10 the result is 1. I have tried setting the output format to have 2 decimal places but it still displays 1 instead of 1.1. [Code]
View 4 RepliesI am fairly new to programming so please bare with me. For my coursework, I am making a maths quiz which allows the teacher to add or edit questions and solutions. then these solutions and quetsions form a quiz that students can access.But I dont know how to allow the teacher to use the weird maths symbols. The quiz is only going to be about algebra so no complex symbols are required, I saw some of these symbols in unicode. But dont know how to make that symbol appear in textbox which the teacher is going to use to enter questions etc.
View 7 RepliesIt'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 would like to develop an application that involves a lot of tables and maths, and then displaying the results. I can visualize how this would work in SQL, as far as creating the stored procedures and tables required, however the front facing application would be a completely new experience to me.I would probably be sharing the built application with friends, but completely as a no profit tool. I assume that the developer edition of dot net is a suitable option? My main query is, is dot net really the best way to develop this tool? I have a strong feeling that I will not be able to use SQL as this would require a server to be run, and this is not practical. Can the tables be implemented into a DLL or similar to be used by the application for example?
View 4 RepliesIs this formula right just asking to see if I can make a file downloader on my own with fully working progress bar.
var/var2 * 100 = answer
I'm going to start delving into maths in vb Now want I want to do is convert the distance between two coordinates. I've found this linke below on the web. Does anyone have a link to good tutorial for this conversion?
View 7 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 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 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 RepliesTrying to get the magnetic track from two waypoints, but are getting error in the formula,
This is my code at the moment (produces error)
tc1.text = Math.Atan2((Math.Sin(lon1.Text - lon2.Text) * Math.Cos(lat2.Text)), Math.Cos(lat1.Text) * Math.Sin(lat2.Text) - Math.Sin(lat1.Text) * Math.Cos(lat2.Text) * Math.Cos(lon1.Text - lon2.Text))) 2 * pi)
I 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]
1) Is it possible to access the Excel mathematical functions without actually opening Excel?
I was thinking of through a DLL WinAPI call or maybe a delegate function or smaller program?
2) Does anyone know of a MS link or area that gives instruction on "how to" use every function of every Windows DLL at all?
Or for all those that Microsoft have chosen to document online at least.
how to convert string to datetime and calculate date
View 3 Replieswhen i enter the date of birth using the datetimepicker box it automatically compute the age and output in a textbox.text?
View 2 RepliesI have the following code, the answer should be 2 though I am getting 3 everytime
[Code]...
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#?
I have an openfiledialog, I show the dialog and the user selects there file. How could I calculate the MD5 hash of the OFD.filename/file opened? Or calculate the SHA1, what ever is easiest.
PS: This is in Visual basic 2010 Express.
Dim
Field1 as
Integer
() = {0, 1, 2, 3, 4, 5, 6, 7}
[code]....
i have the numbers in listbox as below:
01
02
04
09
10
the question is ..how to calculate different between all numbers... exampel between 04 and 09 ,we have 05,06.07 and 08 between 09 and 10 is 0
I have buttons with values. for exmp. btn1 = 5.50 btn2=3.25 etc...when someone click on btn will ask how many of these and let say you say 3 it will multiply that with 5.50 and show it on listbox.
View 1 RepliesI have a project to calculate how many day is there before 05/12/2010.
View 10 RepliesI am struggling with this code that I Have to do about calculating the nth term of the Fibonacci series. The program is supposed to take the value of n and return the corresponding nth Fibonacci number.If the function is given an
invalid n value, it should return -1.
[Code]...
Does anyone know how can I calculate pi (π) in VB?
View 6 Replies