Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Name: Laury Project
- ' Purpose: Displays a shipping charge based on the number of items ordered
- ' Programmer: <Will H> on <01/15.15>
- Option Explicit On
- Option Strict On
- Option Infer Off
- Public Class frmMain
- Private strItems(,) As String = {{"1", "15"},
- {"11", "10"},
- {"51", "5"},
- {"101", "FREE"}}
- Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
- Me.Close()
- End Sub
- Private Sub txtordered_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtOrdered.KeyPress
- ' allows the text box to accept numbers and the Backspace key
- If (e.KeyChar < "0" OrElse e.KeyChar > "9") AndAlso e.KeyChar <> ControlChars.Back Then
- e.Handled = True
- End If
- End Sub
- Private Sub txtordered_TextChanged(sender As Object, e As EventArgs) Handles txtOrdered.TextChanged
- lblShipping.Text = String.Empty
- End Sub
- Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles btnDisplay.Click
- Dim strSearchForId As String
- Dim intRow As Integer
- strSearchForId = txtOrdered.Text
- Do Until intRow > strItems.GetUpperBound(0) OrElse
- strSearchForId = strItems(intRow, 0)
- intRow += 1
- Loop
- If intRow <= strItems.GetUpperBound(0) Then
- Dim intPrice As Integer
- Integer.TryParse(strItems(intRow, 1), intPrice)
- lblShipping.Text = intPrice.ToString("C0")
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement