0% found this document useful (0 votes)
70 views

Visualbasicproj

This document describes a project that illustrates programming logic concepts studied in a semester. It was created by Cheril Grimmett on 4/24/15 and modified by Matt Creech on 4/28/15. The project contains a main form with buttons to exit, reset, and calculate. The calculate button uses input from text boxes to determine a subtotal, apply discounts based on a vendor code, and display the results.

Uploaded by

api-285532395
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views

Visualbasicproj

This document describes a project that illustrates programming logic concepts studied in a semester. It was created by Cheril Grimmett on 4/24/15 and modified by Matt Creech on 4/28/15. The project contains a main form with buttons to exit, reset, and calculate. The calculate button uses input from text boxes to determine a subtotal, apply discounts based on a vendor code, and display the results.

Uploaded by

api-285532395
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

'Project:

RMO case project


'Purpose:
illustrates use of all units of programming logic studied this semester
'Created by:
Cheril Grimmett on 4/24/15
'Modified by:
Matt Creech 4/28/15
'coding calcbutton
Option Explicit On
Option Strict On
Option Infer Of
Public Class mainForm
Private Sub exitButton_Click(sender As Object, e As EventArgs) Handles exitButton.Click
Close()
End Sub
Private Sub resetButton_Click(sender As Object, e As EventArgs) Handles resetButton.Click
qtyTextbox.ResetText()
priceTextbox.ResetText()
vcodeTextbox.ResetText()
subtotalLabel.ResetText()
discountLabel.ResetText()
totalLabel.ResetText()
qtyTextbox.Focus()
End Sub
Private Sub mainForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub calcButton_Click(sender As Object, e As EventArgs) Handles calcButton.Click
'dim variables
Dim quantity As Integer
Dim price As Single
Dim vendorCode As String
Dim discount As Single
Dim subtotal As Single
'Error Check
While Not IsNumeric(qtyTextbox.Text)
qtyTextbox.Text = InputBox("Please enter a valid number for quantity", "ERROR")
End While
While Not IsNumeric(priceTextbox.Text)
priceTextbox.Text = InputBox("Please enter a valid number for price", "ERROR")
End While
quantity = CInt(qtyTextbox.Text)
price = CSng(priceTextbox.Text)
vendorCode = vcodeTextbox.Text
subtotal = (quantity * price)
'select case for determining the discount

Select Case vendorCode


Case Is = "S"
discount = (subtotal
Case Is = "H"
discount = (subtotal
Case Is = "F"
discount = (subtotal
Case Is = "C"
discount = (subtotal
Case Is = "T"
discount = (subtotal
Case Is = "W"
discount = (subtotal
Case Else
subtotal += 12

* 0.2D)
* 0.35D)
* 0.25D)
* 0.2D)
* 0.45D)
* 0.22D)

End Select
subtotalLabel.Text = subtotal.ToString("c2")
discountLabel.Text = discount.ToString("c2")
totalLabel.Text = (subtotal - discount).ToString("C2")
End Sub
End Class

You might also like