Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Option Strict in VS.net 1

Status
Not open for further replies.

kabushnell

Technical User
Joined
Jun 4, 2003
Messages
81
Location
US
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
 
Have you tried this ?
decFutureValue = CDec(intInvestment * (1 + decIntRate) ^ intYears)

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top