Home > database >  Double Percentage round up
Double Percentage round up

Time:11-26

hey guys can you help me i will round up the double like this 1.double a = 0,68777777 -> to a textbox.text = 69% 2.double b = 0,54333333 -> to a textbox.text = 54% but how ?

CodePudding user response:

You can check Math.Round() function, it is surcharged to be able to round double values to int values. Then you'll have to display the int value in your textbox

Also check this post to see some examples

CodePudding user response:

if you are solely looking for the text then you should look into double.ToString(string? format).

Precisely, you're looking for the "P0" format.

  • Related