All pastes #260548 Raw Edit

Anonymous

public text v1 · immutable
#260548 ·published 2006-11-28 13:57 UTC
rendered paste body
Option Explicit

Private curCDValue As Currency
Private dblintrestrate As Double
Private curinitalvalue As Currency
Private curendingvalue As Currency
Private intYears As Integer

Private Sub cmdDone_Click()
    Unload Me
End Sub

Private Sub lblcalculate_Click()
    dblintrestrate = txtintrest.Text / 100
    curendingvalue = txtvalue.Text
    curinitalvalue = txtinvestment.Text
    intYears = 0
    curCDValue = curinitalvalue
    
    Do
        curCDValue = curCDValue + (curCDValue * dblintrestrate)
        intYears = intYears + 1
    Loop While curCDValue < curendingvalue
    lblanswer.Caption = "The number of years is" & intYears
   
    
    
End Sub