我使用此代码在逗号分隔符和点中输入文本框中的货币数量。键入数字时应显示为这种格式(1,258,891.50)。我的代码正在工作,我无法输入点数。它只接受全部数字。下面是我的代码....不接受用点号键入数字的文本框格式
if (textBox5.Text == "")
return;
int n = textBox5.SelectionStart;
decimal text = Convert.ToDecimal(textBox5.Text);
textBox5.Text = String.Format("{0:#,###0}", text);
textBox5.SelectionStart = n + 1;
什么是“textBox5”?你在使用什么平台? – greenfeet