Create an application having 3 controls for entering principal amount,
rate or interest and years. Text box for principal amount should
accept numeric value not less than 5000. track bar for rate of interest
should have values between 5 to 8 having increment of 0.25 (default
value 6.5%) text box for years can have value in the range of 1 to 10
years (factions not allowed , default value 3) on pressing a button
calculate interest, simple interest should be calculated and SET –1n
the label with blue color and bold Arial font with size 24.
Public Class app7
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Asc(e.KeyChar) >= 48 And Asc(e.KeyChar) <= 56 Or Asc(e.KeyChar) = 46 Or Asc(e.KeyChar) = 8 Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub TextBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.LostFocus
If Val(TextBox1.Text) < 5000 Then
MsgBox("Value should not be less then 5000", MsgBoxStyle.Exclamation)
TextBox1.Clear()
TextBox1.Focus()
End If
End Sub
Private Sub TextBox2_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.GotFocus
TextBox2.Clear()
End Sub
Private Sub TextBox2_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.LostFocus
If Val(TextBox2.Text) <= 0 Or TextBox2.Text > 10 Then
MsgBox("Value should be between 1-10")
TextBox2.Clear()
TextBox2.Focus()
End If
End Sub
Dim p, n As Integer
Dim r As Double
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
p = Val(TextBox1.Text)
n = Val(TextBox2.Text)
r = TrackBar1.Value
Label4.Text = (p * r * n) / 100
Label4.Visible = True
End Sub
End Class
Made By: Yadav Roshani R. from Third Year of BCA
Comments
Post a Comment