Public Class Form1
Private Sub Button1_Click(sender As Object,
e As EventArgs) Handles Button1.Click
' 入力値を取得
Dim principal As Double = Convert.ToDouble(TextBox1.Text)
Dim rate As Double = Convert.ToDouble(TextBox2.Text) / 100
' 経過年数と元利合計を計算
Dim years As Integer = 0
Dim amount As Double = principal
While amount <= 2 * principal
amount += amount * rate
years += 1
End While
' 結果を表示
Label5.Text = years.ToString()
Label7.Text = amount.ToString("F2")
End Sub
Private Sub Button2_Click(sender As Object,
e As EventArgs) Handles Button2.Click
TextBox1.ResetText()
TextBox2.ResetText()
Label5.ResetText()
Label7.ResetText()
End Sub
Private Sub Button3_Click(sender As Object,
e As EventArgs) Handles Button3.Click
End
End Sub
End Class