Dim laib As String
Dim laia As String
Dim laii As String
Dim lai As Double
Dim fac As Decimal
Me.LAITableAdapter.FillBy(Me.EcoponicDS.LAI, trt_id, gh_type)
CB.DataSource = EcoponicDS.Tables("LAI")
CB.ValueMember = "factor"
fac = CB.SelectedValue.ToString()
CB.ValueMember = "equ_bef"
laib = CB.SelectedValue.ToString()
CB.ValueMember = "equ_aft"
laia = CB.SelectedValue.ToString()
laii = (laib & age & laia)
lai = eval(laii) 'this doesn't work, cannot convert from string to type int
eval function in VB.NET
Page 1 of 12 Replies - 14983 Views - Last Post: 02 January 2010 - 10:22 PM
#1
eval function in VB.NET
Posted 18 September 2007 - 02:29 AM
I am working with VB.NET, I have many mathematical equations in my windows application, which differ according to many options I selected from previous form. So I m using thesse equation as strings in database and according to the selected options from the previous form it drag the its equation, which I concatinate to a variable (number) according to the selected age. So this equation doesn't work because it defined as nvchar in the databse and the variable is number, I tried the function eval() which I use in asp to solve this but it didn't work. I want to know if there is a function in VB.NET can solve this problem or what can I do to solve it.
Replies To: eval function in VB.NET
#2
Re: eval function in VB.NET
Posted 18 September 2007 - 04:33 AM
I'm not 100% positive what you're attempting to do here, you didnt give a very good explanation, but I believe this is the solution you're looking for
If I'm way off base as to what you're trying to accomplish, please let me know with a better explanation and Ill try to help once again
Dim laib As String
Dim laia As String
Dim laii As String
Dim lai As Double
Dim fac As Decimal
Me.LAITableAdapter.FillBy(Me.EcoponicDS.LAI, trt_id, gh_type)
CB.DataSource = EcoponicDS.Tables("LAI")
CB.ValueMember = "factor"
fac = Convert.ToDecimal(CB.SelectedValue.ToString())
CB.ValueMember = "equ_bef"
laib = Integer.TryParse(CB.SelectedValue, New Integer())
CB.ValueMember = "equ_aft"
laia = Integer.TryParse(CB.SelectedValue, New Integer())
laii = (laib & age & laia)
lai = Convert.ToDouble(laii) 'this doesn't work, cannot convert from string to type int
If I'm way off base as to what you're trying to accomplish, please let me know with a better explanation and Ill try to help once again
#3
Re: eval function in VB.NET
Posted 02 January 2010 - 10:22 PM
Update: vb.net code snippet for eval like behavior.:- EvaluateEquation
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|