Here in this code i will show you how to calculate the Rate of Intrest using VB Forms
Step 1 :
Design a page with 2 textboxes to enter amount and rate of intrest
Step 2 :
Add 3 buttons to clear the fields, Calculate the intrest , quit from application
Step 3 :
Finally add a label to display the result.
What are you waitng for??
Copy the code after designing it !!! Beware with the Contols ID's . Private Sub CmdClear_Click()
' clear text in both the text boxes and lblresult
txtamount.Text = ""
txtintrate.Text = ""
lblresult.Caption = "0"
' set focus to txtamount control
txtamount.SetFocus
End Sub
Private Sub CmdCalculate_Click()
' calculate interst amount and place it lblresult
Dim amount As Single
Dim irate As Single
Dim iamt As Single
amount = CSng(txtamount.Text)
irate = CSng(txtintrate.Text)
' calculate: interest = amount * rate /100
iamt = amount * irate / 100
' place the result in label control
lblresult.Caption = iamt
End Sub
Private Sub cmdQuit_Click()
Unload Me
End Sub
Cheers !!!!