Vb.net 全球化中分配给CurrencyDecimalDigits时出现异常。NumberFormatInfo
我正在vb代码中使用Globalization.NumberFormatInfo,并尝试将值分配给CurrencyDecimalDigits,它是此类的成员:Vb.net 全球化中分配给CurrencyDecimalDigits时出现异常。NumberFormatInfo,vb.net,Vb.net,我正在vb代码中使用Globalization.NumberFormatInfo,并尝试将值分配给CurrencyDecimalDigits,它是此类的成员: Dim a As Globalization.NumberFormatInfo a = New Globalization.NumberFormatInfo() Dim b As Integer = 4 a.CurrencyDecimalDigits = b 在MSDN中,它是一个只读成员,尽管它显示了一个带有赋值的代码
Dim a As Globalization.NumberFormatInfo
a = New Globalization.NumberFormatInfo()
Dim b As Integer = 4
a.CurrencyDecimalDigits = b
在MSDN中,它是一个只读成员,尽管它显示了一个带有赋值的代码:
有没有办法给CurrencyDecimalDigits赋值?
以前有人有过这个问题吗
感谢找到了解决方案,NumberFormatInfo是只读的,因此在分配给它时需要调用clone()方法:Dim a作为全球化。NumberFormatInfo a=新全球化。NumberFormatInfo()a=a.clone()Dim b作为整数=4 a.CurrencyDecimalDigits=b找到了解决方案,NumberFormatInfo是只读的,因此,在为其赋值时需要调用clone()方法:Dim a作为全球化。NumberFormatInfo a=新全球化。NumberFormatInfo()a=a。clone()Dim b作为整数=4 a。CurrencyDecimalDigits=b