Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function ValidateInput(inPut As Object) As Boolean
- If IsNumeric(inPut) Then
- Return inPut > 0
- Else
- Return False
- End If
- End Function
- Function CalculateRetail(WholesaleCost As Decimal, MarkUppercentage As Integer) As Decimal
- ' calculate the retail price
- Return WholesaleCost * ((MarkUppercentage / 100) + 1)
- End Function
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- ' Validate user inpout
- If Not ValidateInput(wholesale.Text) Then
- System.Windows.Forms.MessageBox.Show("Please enter a valid Retail Price")
- Exit Sub
- End If
- If Not ValidateInput(markup.Text) Then
- System.Windows.Forms.MessageBox.Show("Please enter a positive MarkUp Percentage 1 - 100")
- Exit Sub
- End If
- ' Calculate Retail Price
- Label1.Text = "$" & CalculateRetail(wholesale.Text, markup.Text)
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement