user555554
user555554

Reputation: 1

How to compute win/loss percentage in Visual Basic

I found a win, loss, percentage calculator in the forums. The form has a PLACE FOR INPUT

Team Braves 
WINS = 96
LOSS 66

a button Compute Percentage and a text box it should read Braves won 59.259 percent of games. The program in the forums does not work. Does any one know how to do this? The math should be wins / wins+loss * 100. Pleas HELP This is in V B

Upvotes: 0

Views: 2314

Answers (2)

Brian M.
Brian M.

Reputation: 826

If you're looking specifically for that format of number, Double.ToString() can format that for you:

Textbox.Text = ((wins / (wins + losses)) * 100).ToString("#0.###")

Upvotes: 1

escargot agile
escargot agile

Reputation: 22379

Aren't you forgetting the parentheses?

wins / (wins + losses) * 100

Upvotes: 3

Related Questions