Académique Documents
Professionnel Documents
Culture Documents
illustrate creation of interface Cheril Grimmett on 6/26/12 Kayla Self on 4/14/14 Calculated totals for copies, color copies, bindings, cards.
Private Sub exitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitButton.Click Close() End Sub
Private Sub printButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles printButton.Click PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview PrintForm1.Print() End Sub
Dim copies As Single Dim color As Single Dim binding As Single Dim cards As Single Dim letterpages As Integer
Dim lettercopies As Single Dim legalpages As Single Dim legalcopies As Single Dim totalprice As Single Const letterprice As Decimal = 0.05D Const legalprice As Decimal = 0.06D Const colorcopiesprice As Decimal = 0.49D Const cards100 As Single = 65 Const cards150 As Single = 55 Const cards200 As Single = 45 Const bindsprice As Decimal = 1.25D Dim userinput As String
Do If Not IsNumeric(numPagesLetterText.Text) Then userinput = InputBox("Input must be numeric. Please Re-enter.", "INPUT ERROR") numPagesLetterText.Text = userinput.ToString End If Loop Until IsNumeric(numPagesLetterText.Text) Do If Not IsNumeric(numCopiesLetterText.Text) Then userinput = InputBox("Input must be numeric. Please Re-enter.", "INPUT ERROR") numCopiesLetterText.Text = userinput.ToString End If Loop Until IsNumeric(numCopiesLetterText.Text) Do If Not IsNumeric(numPagesLegalText.Text) Then userinput = InputBox("Input must be numeric. Please Re-enter.", "INPUT ERROR")
numPagesLegalText.Text = userinput.ToString End If Loop Until IsNumeric(numPagesLegalText.Text) Do If Not IsNumeric(numCopiesLegalText.Text) Then userinput = InputBox("Input must be numeric. Please Re-enter.", "INPUT ERROR") numCopiesLegalText.Text = userinput.ToString End If Loop Until IsNumeric(numCopiesLegalText.Text)
copies = CSng(copies.ToString) color = CSng(color.ToString) binding = CSng(binding.ToString) cards = CSng(cards.ToString) totalprice = CSng(totalprice.ToString) letterpages = CInt(numPagesLetterText.Text) lettercopies = CSng(numCopiesLetterText.Text) legalpages = CSng(numPagesLegalText.Text) legalcopies = CSng(numCopiesLegalText.Text)
End Select
If cardsRadiobutton.Checked = True Then Dim numCards As Integer = CInt(InputBox("How many business cards are needed?", "Business Cards", "0")) Select Case numCards Case 100 To 149 cards = numCards * cards100 Case 150 To 200 cards = numCards * cards150 Case Is > 200 cards = numCards * cards200 End Select
End If If bindingRadiobutton.Checked = True Then Dim numbindings As Integer = CInt(InputBox("How many sets need to be bound?", "Binding", "0")) binding += bindsprice * numbindings bindingTextlabel.Text = (bindsprice * numbindings).ToString("n2") Else bindingTextlabel.Text = "0.00" End If copies = (lettercopies * letterpages) * letterprice + (legalcopies * legalpages) * legalprice totalprice = copies + color + binding + cards
End Sub
Private Sub resetButton_Click(sender As Object, e As EventArgs) Handles resetButton.Click numPagesLegalText.ResetText() numCopiesLetterText.ResetText() numCopiesLegalText.ResetText() numPagesLetterText.ResetText() Copiestextbox.ResetText() totalPricetext.ResetText() colorTextlabel.ResetText() bindingTextlabel.ResetText() cardsTextlabel.ResetText() bindingRadiobutton.Checked = False cardsRadiobutton.Checked = False colorRadiobutton.Checked = False numPagesLetterText.Focus() End Sub
End Class