Format numbers with floating points and sign in textbox in C#

后端 未结 2 641
小鲜肉
小鲜肉 2021-01-27 10:21

I have multiple textboxes left-aligned vertically. They show numbers with floating points and signs. The numbers are continuously changing. I\'d like to make the position of the

2条回答
  •  礼貌的吻别
    2021-01-27 11:12

    Have you tried String.Format?

    String.Format("{0:0.0000}", 123.4567); //will return "123.4567"
    String.Format("{0:0.0000}", 123.45678); //will return "123.4568"
    

提交回复
热议问题