GUI:
CODE:
Public Class Form1
Dim total As Double
REM Dim keyascii, vbkeydecpt, vbkeyback As Single
Dim cost, discount, nobooks As Single
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cbobooktype.Items.Add("Mathematics")
cbobooktype.Items.Add("Accounting")
cbobooktype.Items.Add("Economics")
cbobooktype.Items.Add("English")
cbobooktype.Items.Add("Marketing")
cbobuyer.Items.Add("Student")
cbobuyer.Items.Add("Teacher")
cbobuyer.Items.Add("Others")
End Sub
Private Sub btntotal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btntotal.Click
nobooks = Val(txtbooks.Text)
If cbobooktype.Text = "Mathematics" Then
cost = 600
ElseIf cbobooktype.Text = "Marketing" Then
cost = 350
ElseIf cbobooktype.Text = "Accounting" Then
cost = 652
ElseIf cbobooktype.Text = "Economics" Then
cost = 510
Else
cost = 350
End If
If cbobuyer.Text = "Student" Then
discount = 65
ElseIf cbobuyer.Text = "Teacher" Then
discount = 85
Else
discount = 40
End If
total = (nobooks * cost) - (nobooks * discount)
lbltotal.Text = "Rs." & "" & FormatNumber(total)
End Sub
Private Sub btnclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclear.Click
cbobooktype.Text = ""
cbobuyer.Text = ""
txtbooks.Text = ""
lbltotal.Text = ""
End Sub
Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexit.Click
Me.Close()
End Sub
End Class
CODE:
Public Class Form1
Dim total As Double
REM Dim keyascii, vbkeydecpt, vbkeyback As Single
Dim cost, discount, nobooks As Single
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cbobooktype.Items.Add("Mathematics")
cbobooktype.Items.Add("Accounting")
cbobooktype.Items.Add("Economics")
cbobooktype.Items.Add("English")
cbobooktype.Items.Add("Marketing")
cbobuyer.Items.Add("Student")
cbobuyer.Items.Add("Teacher")
cbobuyer.Items.Add("Others")
End Sub
Private Sub btntotal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btntotal.Click
nobooks = Val(txtbooks.Text)
If cbobooktype.Text = "Mathematics" Then
cost = 600
ElseIf cbobooktype.Text = "Marketing" Then
cost = 350
ElseIf cbobooktype.Text = "Accounting" Then
cost = 652
ElseIf cbobooktype.Text = "Economics" Then
cost = 510
Else
cost = 350
End If
If cbobuyer.Text = "Student" Then
discount = 65
ElseIf cbobuyer.Text = "Teacher" Then
discount = 85
Else
discount = 40
End If
total = (nobooks * cost) - (nobooks * discount)
lbltotal.Text = "Rs." & "" & FormatNumber(total)
End Sub
Private Sub btnclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclear.Click
cbobooktype.Text = ""
cbobuyer.Text = ""
txtbooks.Text = ""
lbltotal.Text = ""
End Sub
Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexit.Click
Me.Close()
End Sub
End Class
OP:
Comments
Post a Comment
If you have any query, please let us know