kabushnell
Technical User
I am using visual studio.net 2003 and I have a question about Option Strict. I have turned on Option Strict. Then with this code I get the error that "Option Strict On Disallows implicit conversions from 'Double' to 'Decimal'"
I don't really understand why. I thought I had done something very similar to this in another solution and it worked.
Here is the code:
Option Strict On
then I have a button click event with the following code
Dim intInvestment As Integer
Dim decIntRate As Decimal
Dim intYears As Integer
Dim decFutureValue as Decimal
intInvestment = CInt(txtInvestment.Text)
decIntRate = CDec(txtIntRate.Text)
intYears = CInt(txtYears.Text)
decFutureValue = intInvestment * (1 + decIntRate) ^ intYears
I don't really understand why. I thought I had done something very similar to this in another solution and it worked.
Here is the code:
Option Strict On
then I have a button click event with the following code
Dim intInvestment As Integer
Dim decIntRate As Decimal
Dim intYears As Integer
Dim decFutureValue as Decimal
intInvestment = CInt(txtInvestment.Text)
decIntRate = CDec(txtIntRate.Text)
intYears = CInt(txtYears.Text)
decFutureValue = intInvestment * (1 + decIntRate) ^ intYears