Empty String to Double C#

后端 未结 5 1102
误落风尘
误落风尘 2021-01-05 17:56

At this moment i am trying to get a double value from textbox like this:

String.IsNullOrEmpty(textBox1.Text) ? 0.0 : Double.Parse(textBox1.Text)
5条回答
  •  礼貌的吻别
    2021-01-05 18:46

    Did you try Double.TryParse(String, NumberStyles, IFormatProvider, Double%)?

    This could help to solve problems with various number formats.

提交回复
热议问题