Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' project comments go here
- Option Strict On
- Option Explicit On
- Public Class frmBooksale
- Inherits System.Windows.Forms.Form
- #Region "Windows Form Designer generated code "
- Public Sub New()
- MyBase.New()
- 'This call is required by the Windows Form Designer.
- InitializeComponent()
- End Sub
- 'Form overrides dispose to clean up the component list.
- Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
- If Disposing Then
- If Not components Is Nothing Then
- components.Dispose()
- End If
- End If
- MyBase.Dispose(Disposing)
- End Sub
- Private components As System.ComponentModel.IContainer
- 'Required by the Windows Form Designer
- Public ToolTip1 As System.Windows.Forms.ToolTip
- Public WithEvents lblAverageDiscount As System.Windows.Forms.Label
- Public WithEvents Label11 As System.Windows.Forms.Label
- Public WithEvents lblDiscountedAmountSum As System.Windows.Forms.Label
- Public WithEvents lblDiscountSum As System.Windows.Forms.Label
- Public WithEvents lblQuantitySum As System.Windows.Forms.Label
- Public WithEvents Label10 As System.Windows.Forms.Label
- Public WithEvents Label9 As System.Windows.Forms.Label
- Public WithEvents Label8 As System.Windows.Forms.Label
- Public WithEvents lblDiscountedPrice As System.Windows.Forms.Label
- Public WithEvents lblDiscount As System.Windows.Forms.Label
- Public WithEvents lblExtendedPrice As System.Windows.Forms.Label
- Public WithEvents Label7 As System.Windows.Forms.Label
- Public WithEvents Label6 As System.Windows.Forms.Label
- Public WithEvents Label5 As System.Windows.Forms.Label
- Public WithEvents txtPrice As System.Windows.Forms.TextBox
- Public WithEvents txtTitle As System.Windows.Forms.TextBox
- Public WithEvents txtQuantity As System.Windows.Forms.TextBox
- Public WithEvents Label4 As System.Windows.Forms.Label
- Public WithEvents Label3 As System.Windows.Forms.Label
- Public WithEvents Label2 As System.Windows.Forms.Label
- Public WithEvents btnClear As System.Windows.Forms.Button
- Public WithEvents btnExit As System.Windows.Forms.Button
- Public WithEvents btnCalculate As System.Windows.Forms.Button
- Public WithEvents grpSummary As System.Windows.Forms.GroupBox
- Public WithEvents grpOutput As System.Windows.Forms.GroupBox
- Public WithEvents grpInpt As System.Windows.Forms.GroupBox
- Public WithEvents Label1 As System.Windows.Forms.Label
- 'NOTE: The following procedure is required by the Windows Form Designer
- 'It can be modified using the Windows Form Designer.
- 'Do not modify it using the code editor.
- <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
- Me.components = New System.ComponentModel.Container()
- Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
- Me.btnClear = New System.Windows.Forms.Button()
- Me.txtTitle = New System.Windows.Forms.TextBox()
- Me.txtPrice = New System.Windows.Forms.TextBox()
- Me.btnExit = New System.Windows.Forms.Button()
- Me.btnCalculate = New System.Windows.Forms.Button()
- Me.grpInpt = New System.Windows.Forms.GroupBox()
- Me.txtQuantity = New System.Windows.Forms.TextBox()
- Me.Label4 = New System.Windows.Forms.Label()
- Me.Label3 = New System.Windows.Forms.Label()
- Me.Label2 = New System.Windows.Forms.Label()
- Me.grpSummary = New System.Windows.Forms.GroupBox()
- Me.lblAverageDiscount = New System.Windows.Forms.Label()
- Me.Label11 = New System.Windows.Forms.Label()
- Me.lblDiscountedAmountSum = New System.Windows.Forms.Label()
- Me.lblDiscountSum = New System.Windows.Forms.Label()
- Me.lblQuantitySum = New System.Windows.Forms.Label()
- Me.Label10 = New System.Windows.Forms.Label()
- Me.Label9 = New System.Windows.Forms.Label()
- Me.Label8 = New System.Windows.Forms.Label()
- Me.grpOutput = New System.Windows.Forms.GroupBox()
- Me.lblDiscountedPrice = New System.Windows.Forms.Label()
- Me.lblDiscount = New System.Windows.Forms.Label()
- Me.lblExtendedPrice = New System.Windows.Forms.Label()
- Me.Label7 = New System.Windows.Forms.Label()
- Me.Label6 = New System.Windows.Forms.Label()
- Me.Label5 = New System.Windows.Forms.Label()
- Me.Label1 = New System.Windows.Forms.Label()
- Me.grpInpt.SuspendLayout()
- Me.grpSummary.SuspendLayout()
- Me.grpOutput.SuspendLayout()
- Me.SuspendLayout()
- '
- 'btnClear
- '
- Me.btnClear.BackColor = System.Drawing.SystemColors.Control
- Me.btnClear.Cursor = System.Windows.Forms.Cursors.Default
- Me.btnClear.DialogResult = System.Windows.Forms.DialogResult.Cancel
- Me.btnClear.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.btnClear.Location = New System.Drawing.Point(139, 440)
- Me.btnClear.Name = "btnClear"
- Me.btnClear.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.btnClear.Size = New System.Drawing.Size(94, 38)
- Me.btnClear.TabIndex = 17
- Me.btnClear.Text = "C&lear Sale"
- Me.ToolTip1.SetToolTip(Me.btnClear, "Clear the input text boxes for the current sale.")
- Me.btnClear.UseVisualStyleBackColor = False
- '
- 'txtTitle
- '
- Me.txtTitle.AcceptsReturn = True
- Me.txtTitle.BackColor = System.Drawing.SystemColors.Window
- Me.txtTitle.Cursor = System.Windows.Forms.Cursors.IBeam
- Me.txtTitle.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.txtTitle.ForeColor = System.Drawing.SystemColors.WindowText
- Me.txtTitle.Location = New System.Drawing.Point(84, 46)
- Me.txtTitle.MaxLength = 0
- Me.txtTitle.Name = "txtTitle"
- Me.txtTitle.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.txtTitle.Size = New System.Drawing.Size(188, 23)
- Me.txtTitle.TabIndex = 4
- Me.ToolTip1.SetToolTip(Me.txtTitle, "Title of book sold")
- '
- 'txtPrice
- '
- Me.txtPrice.AcceptsReturn = True
- Me.txtPrice.BackColor = System.Drawing.SystemColors.Window
- Me.txtPrice.Cursor = System.Windows.Forms.Cursors.IBeam
- Me.txtPrice.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.txtPrice.ForeColor = System.Drawing.SystemColors.WindowText
- Me.txtPrice.Location = New System.Drawing.Point(84, 74)
- Me.txtPrice.MaxLength = 0
- Me.txtPrice.Name = "txtPrice"
- Me.txtPrice.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.txtPrice.Size = New System.Drawing.Size(76, 23)
- Me.txtPrice.TabIndex = 6
- Me.ToolTip1.SetToolTip(Me.txtPrice, "Price of one book")
- '
- 'btnExit
- '
- Me.btnExit.BackColor = System.Drawing.SystemColors.Control
- Me.btnExit.Cursor = System.Windows.Forms.Cursors.Default
- Me.btnExit.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.btnExit.Location = New System.Drawing.Point(248, 440)
- Me.btnExit.Name = "btnExit"
- Me.btnExit.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.btnExit.Size = New System.Drawing.Size(85, 38)
- Me.btnExit.TabIndex = 16
- Me.btnExit.Text = "E&xit"
- Me.ToolTip1.SetToolTip(Me.btnExit, "Exit the program")
- Me.btnExit.UseVisualStyleBackColor = False
- '
- 'btnCalculate
- '
- Me.btnCalculate.BackColor = System.Drawing.SystemColors.Control
- Me.btnCalculate.Cursor = System.Windows.Forms.Cursors.Default
- Me.btnCalculate.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.btnCalculate.Location = New System.Drawing.Point(29, 440)
- Me.btnCalculate.Name = "btnCalculate"
- Me.btnCalculate.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.btnCalculate.Size = New System.Drawing.Size(94, 38)
- Me.btnCalculate.TabIndex = 15
- Me.btnCalculate.Text = "&Calculate"
- Me.ToolTip1.SetToolTip(Me.btnCalculate, "Calculate this sale and add to summary totals")
- Me.btnCalculate.UseVisualStyleBackColor = False
- '
- 'grpInpt
- '
- Me.grpInpt.BackColor = System.Drawing.SystemColors.Control
- Me.grpInpt.Controls.Add(Me.txtPrice)
- Me.grpInpt.Controls.Add(Me.txtTitle)
- Me.grpInpt.Controls.Add(Me.txtQuantity)
- Me.grpInpt.Controls.Add(Me.Label4)
- Me.grpInpt.Controls.Add(Me.Label3)
- Me.grpInpt.Controls.Add(Me.Label2)
- Me.grpInpt.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.grpInpt.ForeColor = System.Drawing.SystemColors.ControlText
- Me.grpInpt.Location = New System.Drawing.Point(28, 46)
- Me.grpInpt.Name = "grpInpt"
- Me.grpInpt.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.grpInpt.Size = New System.Drawing.Size(422, 112)
- Me.grpInpt.TabIndex = 7
- Me.grpInpt.TabStop = False
- Me.ToolTip1.SetToolTip(Me.grpInpt, "Input sale information for the sale of a book")
- '
- 'txtQuantity
- '
- Me.txtQuantity.AcceptsReturn = True
- Me.txtQuantity.BackColor = System.Drawing.SystemColors.Window
- Me.txtQuantity.Cursor = System.Windows.Forms.Cursors.IBeam
- Me.txtQuantity.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.txtQuantity.ForeColor = System.Drawing.SystemColors.WindowText
- Me.txtQuantity.Location = New System.Drawing.Point(84, 19)
- Me.txtQuantity.MaxLength = 0
- Me.txtQuantity.Name = "txtQuantity"
- Me.txtQuantity.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.txtQuantity.Size = New System.Drawing.Size(67, 23)
- Me.txtQuantity.TabIndex = 2
- Me.ToolTip1.SetToolTip(Me.txtQuantity, "Quantity sold as a whole number")
- '
- 'Label4
- '
- Me.Label4.BackColor = System.Drawing.SystemColors.Control
- Me.Label4.Cursor = System.Windows.Forms.Cursors.Default
- Me.Label4.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.Label4.ForeColor = System.Drawing.SystemColors.ControlText
- Me.Label4.Location = New System.Drawing.Point(18, 74)
- Me.Label4.Name = "Label4"
- Me.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.Label4.Size = New System.Drawing.Size(49, 20)
- Me.Label4.TabIndex = 5
- Me.Label4.Text = "&Price"
- '
- 'Label3
- '
- Me.Label3.BackColor = System.Drawing.SystemColors.Control
- Me.Label3.Cursor = System.Windows.Forms.Cursors.Default
- Me.Label3.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.Label3.ForeColor = System.Drawing.SystemColors.ControlText
- Me.Label3.Location = New System.Drawing.Point(18, 46)
- Me.Label3.Name = "Label3"
- Me.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.Label3.Size = New System.Drawing.Size(49, 20)
- Me.Label3.TabIndex = 3
- Me.Label3.Text = "&Title"
- '
- 'Label2
- '
- Me.Label2.BackColor = System.Drawing.SystemColors.Control
- Me.Label2.Cursor = System.Windows.Forms.Cursors.Default
- Me.Label2.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.Label2.ForeColor = System.Drawing.SystemColors.ControlText
- Me.Label2.Location = New System.Drawing.Point(18, 19)
- Me.Label2.Name = "Label2"
- Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.Label2.Size = New System.Drawing.Size(58, 19)
- Me.Label2.TabIndex = 1
- Me.Label2.Text = "&Quantity"
- '
- 'grpSummary
- '
- Me.grpSummary.BackColor = System.Drawing.SystemColors.Control
- Me.grpSummary.Controls.Add(Me.lblAverageDiscount)
- Me.grpSummary.Controls.Add(Me.Label11)
- Me.grpSummary.Controls.Add(Me.lblDiscountedAmountSum)
- Me.grpSummary.Controls.Add(Me.lblDiscountSum)
- Me.grpSummary.Controls.Add(Me.lblQuantitySum)
- Me.grpSummary.Controls.Add(Me.Label10)
- Me.grpSummary.Controls.Add(Me.Label9)
- Me.grpSummary.Controls.Add(Me.Label8)
- Me.grpSummary.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.grpSummary.ForeColor = System.Drawing.SystemColors.ControlText
- Me.grpSummary.Location = New System.Drawing.Point(28, 287)
- Me.grpSummary.Name = "grpSummary"
- Me.grpSummary.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.grpSummary.Size = New System.Drawing.Size(425, 140)
- Me.grpSummary.TabIndex = 18
- Me.grpSummary.TabStop = False
- Me.grpSummary.Text = "Summary"
- Me.ToolTip1.SetToolTip(Me.grpSummary, "Summary for all sales entered in a single run of the program")
- '
- 'lblAverageDiscount
- '
- Me.lblAverageDiscount.BackColor = System.Drawing.SystemColors.Control
- Me.lblAverageDiscount.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
- Me.lblAverageDiscount.Cursor = System.Windows.Forms.Cursors.Default
- Me.lblAverageDiscount.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.lblAverageDiscount.ForeColor = System.Drawing.SystemColors.ControlText
- Me.lblAverageDiscount.Location = New System.Drawing.Point(290, 102)
- Me.lblAverageDiscount.Name = "lblAverageDiscount"
- Me.lblAverageDiscount.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.lblAverageDiscount.Size = New System.Drawing.Size(104, 19)
- Me.lblAverageDiscount.TabIndex = 26
- Me.lblAverageDiscount.TextAlign = System.Drawing.ContentAlignment.TopRight
- '
- 'Label11
- '
- Me.Label11.BackColor = System.Drawing.SystemColors.Control
- Me.Label11.Cursor = System.Windows.Forms.Cursors.Default
- Me.Label11.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.Label11.ForeColor = System.Drawing.SystemColors.ControlText
- Me.Label11.Location = New System.Drawing.Point(124, 102)
- Me.Label11.Name = "Label11"
- Me.Label11.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.Label11.Size = New System.Drawing.Size(151, 19)
- Me.Label11.TabIndex = 25
- Me.Label11.Text = "Average Discount"
- '
- 'lblDiscountedAmountSum
- '
- Me.lblDiscountedAmountSum.BackColor = System.Drawing.SystemColors.Control
- Me.lblDiscountedAmountSum.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
- Me.lblDiscountedAmountSum.Cursor = System.Windows.Forms.Cursors.Default
- Me.lblDiscountedAmountSum.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.lblDiscountedAmountSum.ForeColor = System.Drawing.SystemColors.ControlText
- Me.lblDiscountedAmountSum.Location = New System.Drawing.Point(290, 74)
- Me.lblDiscountedAmountSum.Name = "lblDiscountedAmountSum"
- Me.lblDiscountedAmountSum.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.lblDiscountedAmountSum.Size = New System.Drawing.Size(104, 20)
- Me.lblDiscountedAmountSum.TabIndex = 24
- Me.lblDiscountedAmountSum.TextAlign = System.Drawing.ContentAlignment.TopRight
- '
- 'lblDiscountSum
- '
- Me.lblDiscountSum.BackColor = System.Drawing.SystemColors.Control
- Me.lblDiscountSum.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
- Me.lblDiscountSum.Cursor = System.Windows.Forms.Cursors.Default
- Me.lblDiscountSum.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.lblDiscountSum.ForeColor = System.Drawing.SystemColors.ControlText
- Me.lblDiscountSum.Location = New System.Drawing.Point(290, 46)
- Me.lblDiscountSum.Name = "lblDiscountSum"
- Me.lblDiscountSum.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.lblDiscountSum.Size = New System.Drawing.Size(104, 20)
- Me.lblDiscountSum.TabIndex = 23
- Me.lblDiscountSum.TextAlign = System.Drawing.ContentAlignment.TopRight
- '
- 'lblQuantitySum
- '
- Me.lblQuantitySum.BackColor = System.Drawing.SystemColors.Control
- Me.lblQuantitySum.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
- Me.lblQuantitySum.Cursor = System.Windows.Forms.Cursors.Default
- Me.lblQuantitySum.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.lblQuantitySum.ForeColor = System.Drawing.SystemColors.ControlText
- Me.lblQuantitySum.Location = New System.Drawing.Point(290, 19)
- Me.lblQuantitySum.Name = "lblQuantitySum"
- Me.lblQuantitySum.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.lblQuantitySum.Size = New System.Drawing.Size(104, 19)
- Me.lblQuantitySum.TabIndex = 22
- Me.lblQuantitySum.TextAlign = System.Drawing.ContentAlignment.TopRight
- '
- 'Label10
- '
- Me.Label10.BackColor = System.Drawing.SystemColors.Control
- Me.Label10.Cursor = System.Windows.Forms.Cursors.Default
- Me.Label10.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.Label10.ForeColor = System.Drawing.SystemColors.ControlText
- Me.Label10.Location = New System.Drawing.Point(124, 74)
- Me.Label10.Name = "Label10"
- Me.Label10.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.Label10.Size = New System.Drawing.Size(151, 20)
- Me.Label10.TabIndex = 21
- Me.Label10.Text = "Total Discounted Amounts"
- '
- 'Label9
- '
- Me.Label9.BackColor = System.Drawing.SystemColors.Control
- Me.Label9.Cursor = System.Windows.Forms.Cursors.Default
- Me.Label9.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.Label9.ForeColor = System.Drawing.SystemColors.ControlText
- Me.Label9.Location = New System.Drawing.Point(124, 46)
- Me.Label9.Name = "Label9"
- Me.Label9.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.Label9.Size = New System.Drawing.Size(151, 20)
- Me.Label9.TabIndex = 20
- Me.Label9.Text = "Total Discounts Given"
- '
- 'Label8
- '
- Me.Label8.BackColor = System.Drawing.SystemColors.Control
- Me.Label8.Cursor = System.Windows.Forms.Cursors.Default
- Me.Label8.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.Label8.ForeColor = System.Drawing.SystemColors.ControlText
- Me.Label8.Location = New System.Drawing.Point(124, 19)
- Me.Label8.Name = "Label8"
- Me.Label8.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.Label8.Size = New System.Drawing.Size(151, 19)
- Me.Label8.TabIndex = 19
- Me.Label8.Text = "Total Number of Books"
- '
- 'grpOutput
- '
- Me.grpOutput.BackColor = System.Drawing.SystemColors.Control
- Me.grpOutput.Controls.Add(Me.lblDiscountedPrice)
- Me.grpOutput.Controls.Add(Me.lblDiscount)
- Me.grpOutput.Controls.Add(Me.lblExtendedPrice)
- Me.grpOutput.Controls.Add(Me.Label7)
- Me.grpOutput.Controls.Add(Me.Label6)
- Me.grpOutput.Controls.Add(Me.Label5)
- Me.grpOutput.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.grpOutput.ForeColor = System.Drawing.SystemColors.ControlText
- Me.grpOutput.Location = New System.Drawing.Point(28, 167)
- Me.grpOutput.Name = "grpOutput"
- Me.grpOutput.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.grpOutput.Size = New System.Drawing.Size(422, 103)
- Me.grpOutput.TabIndex = 8
- Me.grpOutput.TabStop = False
- Me.ToolTip1.SetToolTip(Me.grpOutput, "Information for a single sale")
- '
- 'lblDiscountedPrice
- '
- Me.lblDiscountedPrice.BackColor = System.Drawing.SystemColors.Control
- Me.lblDiscountedPrice.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
- Me.lblDiscountedPrice.Cursor = System.Windows.Forms.Cursors.Default
- Me.lblDiscountedPrice.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.lblDiscountedPrice.ForeColor = System.Drawing.SystemColors.ControlText
- Me.lblDiscountedPrice.Location = New System.Drawing.Point(290, 74)
- Me.lblDiscountedPrice.Name = "lblDiscountedPrice"
- Me.lblDiscountedPrice.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.lblDiscountedPrice.Size = New System.Drawing.Size(104, 20)
- Me.lblDiscountedPrice.TabIndex = 14
- Me.lblDiscountedPrice.TextAlign = System.Drawing.ContentAlignment.TopRight
- '
- 'lblDiscount
- '
- Me.lblDiscount.BackColor = System.Drawing.SystemColors.Control
- Me.lblDiscount.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
- Me.lblDiscount.Cursor = System.Windows.Forms.Cursors.Default
- Me.lblDiscount.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.lblDiscount.ForeColor = System.Drawing.SystemColors.ControlText
- Me.lblDiscount.Location = New System.Drawing.Point(290, 46)
- Me.lblDiscount.Name = "lblDiscount"
- Me.lblDiscount.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.lblDiscount.Size = New System.Drawing.Size(104, 20)
- Me.lblDiscount.TabIndex = 12
- Me.lblDiscount.TextAlign = System.Drawing.ContentAlignment.TopRight
- '
- 'lblExtendedPrice
- '
- Me.lblExtendedPrice.BackColor = System.Drawing.SystemColors.Control
- Me.lblExtendedPrice.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
- Me.lblExtendedPrice.Cursor = System.Windows.Forms.Cursors.Default
- Me.lblExtendedPrice.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.lblExtendedPrice.ForeColor = System.Drawing.SystemColors.ControlText
- Me.lblExtendedPrice.Location = New System.Drawing.Point(290, 19)
- Me.lblExtendedPrice.Name = "lblExtendedPrice"
- Me.lblExtendedPrice.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.lblExtendedPrice.Size = New System.Drawing.Size(104, 19)
- Me.lblExtendedPrice.TabIndex = 10
- Me.lblExtendedPrice.TextAlign = System.Drawing.ContentAlignment.TopRight
- '
- 'Label7
- '
- Me.Label7.BackColor = System.Drawing.SystemColors.Control
- Me.Label7.Cursor = System.Windows.Forms.Cursors.Default
- Me.Label7.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.Label7.ForeColor = System.Drawing.SystemColors.ControlText
- Me.Label7.Location = New System.Drawing.Point(187, 74)
- Me.Label7.Name = "Label7"
- Me.Label7.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.Label7.Size = New System.Drawing.Size(113, 20)
- Me.Label7.TabIndex = 13
- Me.Label7.Text = "Discounted Price"
- '
- 'Label6
- '
- Me.Label6.BackColor = System.Drawing.SystemColors.Control
- Me.Label6.Cursor = System.Windows.Forms.Cursors.Default
- Me.Label6.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.Label6.ForeColor = System.Drawing.SystemColors.ControlText
- Me.Label6.Location = New System.Drawing.Point(187, 46)
- Me.Label6.Name = "Label6"
- Me.Label6.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.Label6.Size = New System.Drawing.Size(132, 20)
- Me.Label6.TabIndex = 11
- Me.Label6.Text = "15% Discount"
- '
- 'Label5
- '
- Me.Label5.BackColor = System.Drawing.SystemColors.Control
- Me.Label5.Cursor = System.Windows.Forms.Cursors.Default
- Me.Label5.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.Label5.ForeColor = System.Drawing.SystemColors.ControlText
- Me.Label5.Location = New System.Drawing.Point(187, 19)
- Me.Label5.Name = "Label5"
- Me.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.Label5.Size = New System.Drawing.Size(94, 19)
- Me.Label5.TabIndex = 9
- Me.Label5.Text = "Extended Price"
- '
- 'Label1
- '
- Me.Label1.BackColor = System.Drawing.SystemColors.Control
- Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
- Me.Label1.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
- Me.Label1.Location = New System.Drawing.Point(187, 9)
- Me.Label1.Name = "Label1"
- Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
- Me.Label1.Size = New System.Drawing.Size(113, 20)
- Me.Label1.TabIndex = 0
- Me.Label1.Text = "Book Sales"
- '
- 'frmBooksale
- '
- Me.AcceptButton = Me.btnCalculate
- Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
- Me.CancelButton = Me.btnClear
- Me.ClientSize = New System.Drawing.Size(592, 603)
- Me.Controls.Add(Me.grpSummary)
- Me.Controls.Add(Me.btnClear)
- Me.Controls.Add(Me.btnExit)
- Me.Controls.Add(Me.btnCalculate)
- Me.Controls.Add(Me.grpOutput)
- Me.Controls.Add(Me.grpInpt)
- Me.Controls.Add(Me.Label1)
- Me.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.Location = New System.Drawing.Point(3, 18)
- Me.Name = "frmBooksale"
- Me.Text = "R 'n R for Reading 'n Refreshment"
- Me.grpInpt.ResumeLayout(False)
- Me.grpSummary.ResumeLayout(False)
- Me.grpOutput.ResumeLayout(False)
- Me.ResumeLayout(False)
- End Sub
- #End Region
- ' dimension module-level variables and constants
- ' running total of quantity of books sold
- Dim mintQuantitySum As Integer
- ' Sum of all discounts
- Dim mdecDiscountSum As Decimal
- ' running total of sales after discount
- Dim mdecDiscountedPriceSum As Decimal
- ' count of sales today
- Dim mintSaleCount As Integer
- ' declare constants
- Const mdecDISCOUNT_RATE As Decimal = 0.15D
- Private Sub frmBooksale_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- End Sub
- Private Sub btnCalculate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
- ' calculate price and discount
- Dim intQuantity As Integer
- Dim decPrice As Decimal
- Dim decExtendedPrice As Decimal
- Dim decDiscount As Decimal
- Dim decDiscountedPrice As Decimal
- Dim decAverageDiscount As Decimal
- ' assign values to input variables
- Try
- intQuantity = Integer.Parse(txtQuantity.Text)
- Try
- decPrice = Decimal.Parse(txtPrice.Text)
- 'calculate values for individual sale
- decExtendedPrice = intQuantity * decPrice
- decDiscount = decExtendedPrice * mdecDISCOUNT_RATE
- decDiscountedPrice = decExtendedPrice - decDiscount
- ' calculate values for all sales
- mintQuantitySum = intQuantity + mintQuantitySum
- ' could be written:
- ' mintQuantity += intQuantity
- mdecDiscountSum = mdecDiscountSum + decDiscount
- mdecDiscountedPriceSum = mdecDiscountedPriceSum + decDiscountedPrice
- mintSaleCount += 1
- decAverageDiscount = mdecDiscountSum / mintSaleCount
- 'format and display output for sale
- ' C in tostring formats it as currency
- lblExtendedPrice.Text = decExtendedPrice.ToString("C")
- lblDiscount.Text = decDiscount.ToString("C")
- lblDiscountedPrice.Text = decDiscountedPrice.ToString("C")
- ' format and display summary values
- ' N in tostring formats it as a number
- lblQuantitySum.Text = mintQuantitySum.ToString("N")
- lblDiscountSum.Text = mdecDiscountedPriceSum.ToString("C")
- lblDiscountedAmountSum.Text = mdecDiscountedPriceSum.ToString("C")
- lblAverageDiscount.Text = decAverageDiscount.ToString("C")
- Catch myErr As Exception
- MessageBox.Show("Error: " & myErr.Message, "Data Entry Error", MessageBoxButtons.OK, _
- MessageBoxIcon.Exclamation)
- With txtPrice
- .Clear()
- .Focus()
- End With
- End Try
- Catch myErr As Exception
- MessageBox.Show("Error: " & myErr.Message, "Data Entry Error", MessageBoxButtons.OK, _
- MessageBoxIcon.Exclamation)
- With txtQuantity
- .Clear()
- .Focus()
- End With
- End Try
- End Sub
- End Class
Add Comment
Please, Sign In to add comment