0

我在 vb 代码中使用 Globalization.NumberFormatInfo 并尝试将值分配给作为此类成员的 CurrencyDecimalDigits:

  Dim a As Globalization.NumberFormatInfo
  a = New Globalization.NumberFormatInfo()
  Dim b As Integer = 4
  a.CurrencyDecimalDigits = b

在 MSDN 中它被写入它是一个只读成员,尽管它显示了一个分配给它的代码:http: //msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo.currencydecimaldigits.aspx

有没有办法为 CurrencyDecimalDigits 赋值?以前有人遇到过这个问题吗?

谢谢

4

1 回答 1

0

Found the solution, NumberFormatInfo is read only, therefore need to call clone() method when assigning to it:Dim a As Globalization.NumberFormatInfo a = New Globalization.NumberFormatInfo() a = a.Clone() Dim b As Integer = 4 a.CurrencyDecimalDigits = b

于 2013-07-29T09:33:27.993 回答