2010-11-11, 05:32 PM
A simple way to handle this is:
Excuse me if my coding is dirty, I haven't touched this in two years. Also, if you want to allow negative markups, you may want to remove that MsgBox line but do something else to prevent negative curRetail, like:
Code:
Private Sub CalcRetail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalcRetail.Click Dim curWholesale, curRetail as Currency, decMarkup As Decimal
curWholesale = txtWholesale.Text
decMarkup = txtMarkup.text / 100
If decMarkup < 0 Then
MsgBox("Markup percentage cannot be lower than 0%.")
End If
curRetail = curWholeSale * decMarkup
lblRetail.Text = curRetail
End SubExcuse me if my coding is dirty, I haven't touched this in two years. Also, if you want to allow negative markups, you may want to remove that MsgBox line but do something else to prevent negative curRetail, like:
Code:
If curRetail < 0 Then
curRetail = 0
End If
