50% found this document useful (2 votes)
7K views

Finding Simple Interest and Compound Interest Using VB

This document provides code for a Visual Basic program to calculate simple and compound interest. It includes declarations for variables to store the principal, years, interest rate, and interest amount. The code uses an if statement to check which radio button is selected and calculates either simple or compound interest accordingly, outputting the result. It also includes code to clear the input fields and exit the program. The end includes a separate code example to calculate the sum of numbers from 1 to 10.

Uploaded by

sakthivel
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
50% found this document useful (2 votes)
7K views

Finding Simple Interest and Compound Interest Using VB

This document provides code for a Visual Basic program to calculate simple and compound interest. It includes declarations for variables to store the principal, years, interest rate, and interest amount. The code uses an if statement to check which radio button is selected and calculates either simple or compound interest accordingly, outputting the result. It also includes code to clear the input fields and exit the program. The end includes a separate code example to calculate the sum of numbers from 1 to 10.

Uploaded by

sakthivel
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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