fork download
  1. Public Class Form1
  2. Dim strItem As String = "Item"
  3. Dim strQuantity As String = "Quantity"
  4. Dim strPrice As String = "Price"
  5. Dim strSubTotal As String = "Subtotal"
  6. Dim decTotal As Decimal
  7. Dim strTxtHeader As String = strItem & strQuantity.PadLeft(15) & strPrice.PadLeft(15) & strSubTotal.PadLeft(15) & ControlChars.NewLine
  8.  
  9. Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  10. ' loads the text box header when the form loads
  11.  
  12. txtOutPut.Text = strTxtHeader
  13. End Sub
  14.  
  15. Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
  16. ' taking the input from the text box's and putting them in the Table
  17. ' multiplies the quantity needed plus the unit price to get the subtotal
  18.  
  19. Dim decSubTotal As Decimal
  20. Dim intQuantity As Integer
  21. Dim decPrice As Decimal
  22. Dim strItem As String
  23.  
  24. Decimal.TryParse(txtQuantity.Text, intQuantity)
  25. Integer.TryParse(txtPrice.Text, decPrice)
  26.  
  27. strItem = txtItem.Text
  28.  
  29. decSubTotal = decPrice * intQuantity
  30.  
  31. decTotal = decTotal + decSubTotal
  32.  
  33. txtOutPut.Text = txtOutPut.Text & strItem & intQuantity.ToString.PadLeft(15) & decPrice.ToString.PadLeft(15) & decSubTotal.ToString.PadLeft(15) & ControlChars.NewLine
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty