Hi , i want to declare mathematical expression between values from datatable , for example: i have two columns named 'Variable'(string) and 'Contents' (float) , i have inserted in 'Variables' 3 string a , b and c and in 'Contents' 3 floats are 0, 3 and 6 .Now i want to declare 'a=b+c' in code an when i click on a 'button' the variable a will change in datatable to 9. here is my code but it doesn't work!! help me please !
Hi , i have to evaluate expressions with floats with that code if i type 0.23 or any float it shows me an error "“Error evaluating '0.23' as a constant.” please help me what i have to change in that code?
Yes i put a condition if variable[j]=="" and it works now , thank you all for help , i want to ask now another question if someone can answer me i'll be happy , i want to add a func_var which remove strings like 'cos' or 'sin' or 'tan' from string expression , did someone have an idea how to do that ?
I want to evaluate an a string math expression , so before i want to extract variables so i have to remove all special characters my code only can remove a special character like `a+b*c` and the result i get is `a=;b=;c=`, now if i write two successive special characters like `(a+b)*c` and `a++b` results will be `=;a=;b=;c=` and `a=;=;b=` always there is a sign `=;` added for no reasons so how to get rid of them because after that i will use mathematic functions so that will be a real problem for me please help me ! here is my code
for example :
In the begining i have a table of data which contain two columns (column1 of names of variables (named `Variable`)and column2 of contents with type float (named `Contents`) , i inserted 3 variables `var1` , `var2` and `var3` in that table with their contents successively 0 , 6.9 and 8.3 . Now i have a textbox1 in the gui i want to be able to write in it my expression var1=var2*cos(var3) and when i click on a button the result (-2.9765002303) will be showed in another textbox2 , and the value 0 (initial value of var1) will be changed to -2.9765002303 in the table of data (after calcul), i hope that it's more clear now ! thank you
I think that you didn't understand my problem , i'm searching how can i read with an only textbox 2 variables separated with an operand , how can a textbox get two variables picked from the same column of datatable?
My objective is to type an operation (operands and operators) in a single expressionTextBox and if I click on a button the result will be displayed.
For example, after inserting 3 variables of type float var1, var2 and var3 (in a table of data with their content values ) I want to write in the expressionTextBox var1 = var2 + var3 (or '*' or '-'...) and the result of var1 will be displayed in ResultTextbox.
Is this the right way to do that? The textbox has to be able to understand more than one variable from datatable and has to understand operands for the operation. Are there other methods using listBox! Help me please !