Guest User

Untitled

a guest
Apr 22nd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class frmCanadianTireInventoryApp
  2.  
  3.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  4.         lblDate.Text = "Canadian Tire Inventory Application       Date : " & FormatDateTime(Now, DateFormat.LongDate)
  5.     End Sub
  6.  
  7.     Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
  8.         Dim blnquantity As Boolean
  9.         Dim blnproductname As Boolean
  10.         Dim blnproductcode As Boolean
  11.         Dim blnProductprice As Boolean
  12.         Dim productCode As Integer
  13.         Dim productQuantity As Integer
  14.         Dim Productprice As Double = 0.0
  15.         Dim totalPrice As Double = 0.0
  16.         Dim strquantity As String
  17.         Dim strname As String = Nothing
  18.         Dim strcode As String
  19.         Dim strprice As String
  20.         Dim cmd As Integer = 0
  21.         Static totalsales As Double = 0.0
  22.  
  23.         Do
  24.  
  25.             Do
  26.                 If cmd = 1 Then
  27.                     Exit Do
  28.                 End If
  29.                 strname = InputBox("Enter a Product Name" & " :", "Product Name")
  30.                 If strname = "" Then
  31.                     MessageBox.Show("Goodbye!", "GOOD-BYE~!", MessageBoxButtons.OK, MessageBoxIcon.Information)
  32.                     cmd = 1
  33.                     Exit Do
  34.                 ElseIf IsNumeric(strname) = True Then
  35.                     If CInt(strname) = 0 Then
  36.                         MsgBox("NO INPUT!", MsgBoxStyle.Critical, "ERROR")
  37.                         blnproductname = True
  38.                     ElseIf CInt(strname) = 999 Then
  39.                         MessageBox.Show("Signing out!", "Sign-out", MessageBoxButtons.OK, MessageBoxIcon.Information)
  40.                         lblTotalSales.Text = "Total sales : " & FormatCurrency(totalsales)
  41.                         cmd = 2
  42.                         Exit Sub
  43.                     Else
  44.                         blnproductname = False
  45.                     End If
  46.                 Else
  47.                     blnproductname = False
  48.                 End If
  49.             Loop Until blnproductname = False
  50.  
  51.  
  52.  
  53.             Do
  54.                 If cmd = 1 Then
  55.                     Exit Do
  56.                 End If
  57.  
  58.                 strcode = InputBox("Enter a Product Code" & " :", "Product Code")
  59.                 If strcode = "" Then
  60.                     MessageBox.Show("Goodbye!", "GOOD-BYE~!", MessageBoxButtons.OK, MessageBoxIcon.Information)
  61.                     cmd = 1
  62.                     Exit Do
  63.                 ElseIf IsNumeric(strcode) = True Then
  64.                     If strcode.Length > 4 Then
  65.                         MessageBox.Show("Incorrect code range!" & vbNewLine & "(1000 - 9999)", "Canadian Trire", MessageBoxButtons.OK, MessageBoxIcon.Information)
  66.                         blnproductcode = True
  67.                     ElseIf CInt(strcode) = 0 Then
  68.                         MsgBox("NO INPUT!", MsgBoxStyle.Critical, "ERROR")
  69.                         blnproductcode = True
  70.                     ElseIf CInt(strcode) < 1000 Then
  71.                         MessageBox.Show("Incorrect code range!" & vbNewLine & "(1000 - 9999)", "Canadian Trire", MessageBoxButtons.OK, MessageBoxIcon.Information)
  72.                         blnproductcode = True
  73.                     ElseIf CInt(strcode) > 9999 Then
  74.                         MessageBox.Show("Incorrect code range!" & vbNewLine & "(1000 - 9999)", "Canadian Trire", MessageBoxButtons.OK, MessageBoxIcon.Information)
  75.                         blnproductcode = True
  76.                     Else
  77.                         blnproductname = False
  78.                         productCode = CInt(strcode)
  79.                     End If
  80.                 Else
  81.                     blnproductname = False
  82.                     MessageBox.Show("Enter a numberic value!", "Canadian Tire", MessageBoxButtons.OK, MessageBoxIcon.Error)
  83.                 End If
  84.             Loop Until blnproductname = False And productCode >= 1000 And productCode <= 9999
  85.  
  86.             Do
  87.                 If cmd = 1 Then
  88.                     Exit Do
  89.                 End If
  90.  
  91.                 strquantity = InputBox("Enter Quantity" & " :", "Quantity")
  92.                 If strquantity = "" Then
  93.                     MessageBox.Show("Goodbye!", "GOOD-BYE~!", MessageBoxButtons.OK, MessageBoxIcon.Information)
  94.                     Exit Do
  95.                     Application.Exit()
  96.                 ElseIf IsNumeric(strquantity) = True Then
  97.                     If CInt(strquantity) = 0 Then
  98.                         MsgBox("NO INPUT!", MsgBoxStyle.Critical, "ERROR")
  99.                         blnquantity = True
  100.                     ElseIf CInt(strquantity) < 1 Then
  101.                         MessageBox.Show("Incorrect quantity range!" & vbNewLine & "(1 - 100)", "Canadian Trire", MessageBoxButtons.OK, MessageBoxIcon.Information)
  102.                         blnquantity = True
  103.                     ElseIf CInt(strquantity) > 100 Then
  104.                         MessageBox.Show("Incorrect quantity range!" & vbNewLine & "(1 - 100)", "Canadian Trire", MessageBoxButtons.OK, MessageBoxIcon.Information)
  105.                         blnquantity = True
  106.                     ElseIf strquantity.Length > 4 Then
  107.                         MessageBox.Show("Incorrect quantity range!" & vbNewLine & "(1 - 100)", "Canadian Trire", MessageBoxButtons.OK, MessageBoxIcon.Information)
  108.                         blnquantity = True
  109.                     Else
  110.                         blnproductname = False
  111.                         productQuantity = CInt(strquantity)
  112.                     End If
  113.                 Else
  114.                     blnquantity = False
  115.                     MessageBox.Show("Enter a numberic value!", "Canadian Tire", MessageBoxButtons.OK, MessageBoxIcon.Error)
  116.                 End If
  117.             Loop Until blnquantity = False And productQuantity >= 1 And productCode <= 100
  118.  
  119.             Do
  120.                 If cmd = 1000 Then
  121.                     Exit Do
  122.                 End If
  123.  
  124.                 strprice = InputBox("Enter Product Price" & " :", "Product Price")
  125.                 If strprice = "" Then
  126.                     MessageBox.Show("Goodbye!", "GOOD-BYE~!", MessageBoxButtons.OK, MessageBoxIcon.Information)
  127.                     Exit Do
  128.                     Application.Exit()
  129.                 ElseIf IsNumeric(strprice) = True Then
  130.                     If CInt(strprice) = 0 Then
  131.                         MsgBox("NO INPUT!", MsgBoxStyle.Critical, "ERROR")
  132.                         blnProductprice = True
  133.                     ElseIf CInt(strprice) < 1 Then
  134.                         MessageBox.Show("Incorrect price range!" & vbNewLine & "(1 - 1000)", "Canadian Trire", MessageBoxButtons.OK, MessageBoxIcon.Information)
  135.                         blnProductprice = True
  136.                     ElseIf CInt(strprice) > 1000 Then
  137.                         MessageBox.Show("Incorrect price range!" & vbNewLine & "(1 - 1000)", "Canadian Trire", MessageBoxButtons.OK, MessageBoxIcon.Information)
  138.                         blnProductprice = True
  139.                     ElseIf strprice.Length > 4 Then
  140.                         MessageBox.Show("Incorrect price range!" & vbNewLine & "(1 - 1000)", "Canadian Trire", MessageBoxButtons.OK, MessageBoxIcon.Information)
  141.                         blnProductprice = True
  142.                     Else
  143.                         blnProductprice = False
  144.                         productQuantity = CInt(strprice)
  145.                     End If
  146.                 Else
  147.                     blnProductprice = False
  148.                     MessageBox.Show("Enter a numberic value!", "Canadian Tire", MessageBoxButtons.OK, MessageBoxIcon.Error)
  149.                 End If
  150.             Loop Until blnProductprice = False And Productprice >= 1 And Productprice <= 1000
  151.  
  152.             lstProductName.Items.Add(strname)
  153.             lstProductCode.Items.Add(productCode)
  154.             lstQuantity.Items.Add(productQuantity)
  155.             lstPricePerProduct.Items.Add(Productprice)
  156.  
  157.         Loop Until cmd = 1
  158.  
  159.  
  160.     End Sub
  161.  
  162.     Private Sub btnEnd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnd.Click
  163.  
  164.     End Sub
  165. End Class
Add Comment
Please, Sign In to add comment