Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class frmCanadianTireInventoryApp
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- lblDate.Text = "Canadian Tire Inventory Application Date : " & FormatDateTime(Now, DateFormat.LongDate)
- End Sub
- Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
- Dim blnquantity As Boolean
- Dim blnproductname As Boolean
- Dim blnproductcode As Boolean
- Dim blnProductprice As Boolean
- Dim productCode As Integer
- Dim productQuantity As Integer
- Dim Productprice As Double = 0.0
- Dim totalPrice As Double = 0.0
- Dim strquantity As String
- Dim strname As String = Nothing
- Dim strcode As String
- Dim strprice As String
- Dim cmd As Integer = 0
- Static totalsales As Double = 0.0
- Do
- Do
- If cmd = 1 Then
- Exit Do
- End If
- strname = InputBox("Enter a Product Name" & " :", "Product Name")
- If strname = "" Then
- MessageBox.Show("Goodbye!", "GOOD-BYE~!", MessageBoxButtons.OK, MessageBoxIcon.Information)
- cmd = 1
- Exit Do
- ElseIf IsNumeric(strname) = True Then
- If CInt(strname) = 0 Then
- MsgBox("NO INPUT!", MsgBoxStyle.Critical, "ERROR")
- blnproductname = True
- ElseIf CInt(strname) = 999 Then
- MessageBox.Show("Signing out!", "Sign-out", MessageBoxButtons.OK, MessageBoxIcon.Information)
- lblTotalSales.Text = "Total sales : " & FormatCurrency(totalsales)
- cmd = 2
- Exit Sub
- Else
- blnproductname = False
- End If
- Else
- blnproductname = False
- End If
- Loop Until blnproductname = False
- Do
- If cmd = 1 Then
- Exit Do
- End If
- strcode = InputBox("Enter a Product Code" & " :", "Product Code")
- If strcode = "" Then
- MessageBox.Show("Goodbye!", "GOOD-BYE~!", MessageBoxButtons.OK, MessageBoxIcon.Information)
- cmd = 1
- Exit Do
- ElseIf IsNumeric(strcode) = True Then
- If strcode.Length > 4 Then
- MessageBox.Show("Incorrect code range!" & vbNewLine & "(1000 - 9999)", "Canadian Trire", MessageBoxButtons.OK, MessageBoxIcon.Information)
- blnproductcode = True
- ElseIf CInt(strcode) = 0 Then
- MsgBox("NO INPUT!", MsgBoxStyle.Critical, "ERROR")
- blnproductcode = True
- ElseIf CInt(strcode) < 1000 Then
- MessageBox.Show("Incorrect code range!" & vbNewLine & "(1000 - 9999)", "Canadian Trire", MessageBoxButtons.OK, MessageBoxIcon.Information)
- blnproductcode = True
- ElseIf CInt(strcode) > 9999 Then
- MessageBox.Show("Incorrect code range!" & vbNewLine & "(1000 - 9999)", "Canadian Trire", MessageBoxButtons.OK, MessageBoxIcon.Information)
- blnproductcode = True
- Else
- blnproductname = False
- productCode = CInt(strcode)
- End If
- Else
- blnproductname = False
- MessageBox.Show("Enter a numberic value!", "Canadian Tire", MessageBoxButtons.OK, MessageBoxIcon.Error)
- End If
- Loop Until blnproductname = False And productCode >= 1000 And productCode <= 9999
- Do
- If cmd = 1 Then
- Exit Do
- End If
- strquantity = InputBox("Enter Quantity" & " :", "Quantity")
- If strquantity = "" Then
- MessageBox.Show("Goodbye!", "GOOD-BYE~!", MessageBoxButtons.OK, MessageBoxIcon.Information)
- Exit Do
- Application.Exit()
- ElseIf IsNumeric(strquantity) = True Then
- If CInt(strquantity) = 0 Then
- MsgBox("NO INPUT!", MsgBoxStyle.Critical, "ERROR")
- blnquantity = True
- ElseIf CInt(strquantity) < 1 Then
- MessageBox.Show("Incorrect quantity range!" & vbNewLine & "(1 - 100)", "Canadian Trire", MessageBoxButtons.OK, MessageBoxIcon.Information)
- blnquantity = True
- ElseIf CInt(strquantity) > 100 Then
- MessageBox.Show("Incorrect quantity range!" & vbNewLine & "(1 - 100)", "Canadian Trire", MessageBoxButtons.OK, MessageBoxIcon.Information)
- blnquantity = True
- ElseIf strquantity.Length > 4 Then
- MessageBox.Show("Incorrect quantity range!" & vbNewLine & "(1 - 100)", "Canadian Trire", MessageBoxButtons.OK, MessageBoxIcon.Information)
- blnquantity = True
- Else
- blnproductname = False
- productQuantity = CInt(strquantity)
- End If
- Else
- blnquantity = False
- MessageBox.Show("Enter a numberic value!", "Canadian Tire", MessageBoxButtons.OK, MessageBoxIcon.Error)
- End If
- Loop Until blnquantity = False And productQuantity >= 1 And productCode <= 100
- Do
- If cmd = 1000 Then
- Exit Do
- End If
- strprice = InputBox("Enter Product Price" & " :", "Product Price")
- If strprice = "" Then
- MessageBox.Show("Goodbye!", "GOOD-BYE~!", MessageBoxButtons.OK, MessageBoxIcon.Information)
- Exit Do
- Application.Exit()
- ElseIf IsNumeric(strprice) = True Then
- If CInt(strprice) = 0 Then
- MsgBox("NO INPUT!", MsgBoxStyle.Critical, "ERROR")
- blnProductprice = True
- ElseIf CInt(strprice) < 1 Then
- MessageBox.Show("Incorrect price range!" & vbNewLine & "(1 - 1000)", "Canadian Trire", MessageBoxButtons.OK, MessageBoxIcon.Information)
- blnProductprice = True
- ElseIf CInt(strprice) > 1000 Then
- MessageBox.Show("Incorrect price range!" & vbNewLine & "(1 - 1000)", "Canadian Trire", MessageBoxButtons.OK, MessageBoxIcon.Information)
- blnProductprice = True
- ElseIf strprice.Length > 4 Then
- MessageBox.Show("Incorrect price range!" & vbNewLine & "(1 - 1000)", "Canadian Trire", MessageBoxButtons.OK, MessageBoxIcon.Information)
- blnProductprice = True
- Else
- blnProductprice = False
- productQuantity = CInt(strprice)
- End If
- Else
- blnProductprice = False
- MessageBox.Show("Enter a numberic value!", "Canadian Tire", MessageBoxButtons.OK, MessageBoxIcon.Error)
- End If
- Loop Until blnProductprice = False And Productprice >= 1 And Productprice <= 1000
- lstProductName.Items.Add(strname)
- lstProductCode.Items.Add(productCode)
- lstQuantity.Items.Add(productQuantity)
- lstPricePerProduct.Items.Add(Productprice)
- Loop Until cmd = 1
- End Sub
- Private Sub btnEnd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnd.Click
- End Sub
- End Class
Add Comment
Please, Sign In to add comment