DataGridView TextBox value conversion to decimal (with fixed point)
In a TextBox
in DataGridView
when I type in example 50.30
and then I convert it to decimal
using:
decimal money = Convert.ToDecimal(dgv.Rows[0].Cells[2].Value);
it conver开发者_JAVA百科ts to 5030, not to 50.30... :(
or if it's 50 I need it to be converted to 50,0000 like the money type in sql server.
Any help?
thank you
You should use
Convert.ToDecimal(Object value, IFormatProvider provider)
Where provider is instace of your class.
精彩评论