You are on page 1of 2

Finding Simple Interest And Compound Interest e-mail code snippet

This is a simple vb.net 2005 program to find simple interest and compound interest...
Declarations:
1. 'Create a windows application n rename it as InsertDemo...
2. 'Place radio buttons, labels, buttons and text boxes in the form n rename it...
3. 'Double click calculate button n write the given code below...
4. 'Save all n execute... give values to calculate...

Code:
Public Class Form1
Private Sub btnCalculate_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btnCalculate.Click
Dim principal, years As Integer
Dim rate, interest, amount As Single

principal = txtPrincipal.Text
years = txtYears.Text
rate = txtRate.Text

If rbSimpleInterest.Checked = True Then


interest = (principal * years * rate) / 100
Else
amount = principal * Math.Pow((1 + rate / 100), years)
interest = amount - principal
End If
txtInterest.Text = interest
End Sub

Private Sub btnClear_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
btnClear.Click
txtPrincipal.Text = " "
txtYears.Text = " "
txtRate.Text = " "
txtInterest.Text = " "
End Sub

Private Sub btnExit_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles btnExit.Click
End
End Sub
End Class
Write a program in visual basic to calculate and print sum of ten number from one to ten?

Private Sub Command1_Click()


Dim i, s As Integer
Cls
Dim n as integer
Print "Enter N Value = "; n
For i = 1 To n
s=s+i
Next i
Print "Sum of N Number = "; s
End Sub

You might also like