I have a number of type double 12.2301000
I need to get 12.23
p.s. I do not need rounding.
I need to get 12.23
p.s. I do not need rounding.
String.Format("{0:0.00}", 123.4567);
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (char.IsNumber(e.KeyChar) || e.KeyChar=='.')
{
if (Regex.IsMatch(textBox1.Text, "^\\d*\\.\\d{2}$"))
e.Handled=true;
}
else
e.Handled = e.KeyChar != (char)Keys.Back;
}
Comment