Simple interest and Compound interest in VB.NET.(textboxes and radio button that calculate interest)
PROPERTIES:
CODEING:
Label | |
Text | Amount |
Labe2 | |
Text | Rate(per year) |
Labe3 | |
Text | Year |
Labe4 | |
Text | Compounding Period |
RadioButton1 | |
Text | Simple Interest |
RadioButton2 | |
Text | Compound Interset |
Button1 | |
Text | OK |
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If RadioButton1.Checked = True Then
Label5.Text = "Simple Interest:" & (Val(TextBox1.Text) * (Val(TextBox2.Text) / 100) * Val(TextBox3.Text) / 100)
ElseIf RadioButton2.Checked = True Then
Label5.Text = "Compund Interest:" & Val(TextBox1.Text) * ((1 + ((Val(TextBox2.Text) / 100) / NumericUpDown1.Value)) ^ (NumericUpDown1.Value * Val(TextBox3.Text)))
End If
End Sub
Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton2.CheckedChanged, RadioButton1.CheckedChanged
If RadioButton2.Checked Then
NumericUpDown1.Visible = True
Label4.Visible = True
Else
NumericUpDown1.Visible = False
Label4.Visible = False
End If
End Sub
End Class
DESIGNING:Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If RadioButton1.Checked = True Then
Label5.Text = "Simple Interest:" & (Val(TextBox1.Text) * (Val(TextBox2.Text) / 100) * Val(TextBox3.Text) / 100)
ElseIf RadioButton2.Checked = True Then
Label5.Text = "Compund Interest:" & Val(TextBox1.Text) * ((1 + ((Val(TextBox2.Text) / 100) / NumericUpDown1.Value)) ^ (NumericUpDown1.Value * Val(TextBox3.Text)))
End If
End Sub
Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton2.CheckedChanged, RadioButton1.CheckedChanged
If RadioButton2.Checked Then
NumericUpDown1.Visible = True
Label4.Visible = True
Else
NumericUpDown1.Visible = False
Label4.Visible = False
End If
End Sub
End Class
Comments
Post a Comment