![]() |
|
VB. Help with percentage. - Printable Version +- Southperry.net (https://www.southperry.net) +-- Forum: Maplers Helping Maplers (https://www.southperry.net/forumdisplay.php?fid=9) +--- Forum: Technical Help (https://www.southperry.net/forumdisplay.php?fid=84) +--- Thread: VB. Help with percentage. (/showthread.php?tid=32604) |
VB. Help with percentage. - Khoi - 2010-11-11 Basically, this is what I am supposed to do: Quote:Write an application that accepts from the user the wholesale cost of an item and its markup percentage. (For example, if an item's wholesale cost is $5 and its retail price is $10, the the markup is 100%. What I have so far (and I think I'm doing this wrong, I just hit a dead-end at the percentage): ![]() ![]() The set that grey'd out area as lblRetail, because in the book, the Retail Price number is the answer. VB. Help with percentage. - Jedward - 2010-11-11 A simple way to handle this is: 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 DecimalExcuse 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 ThenVB. Help with percentage. - Khoi - 2010-11-11 Infection Wrote:A simple way to handle this is: No problem. Thanks for the help, actually. Going to try that, actually. I never thought of even using "If" statements. :| |