I am using this code to type the currency amounts in a textbox with comma seperators and points. While typing numbers should display like this format(1,258,891.50). My code is working bt I can't type points. Its accepting only full numbers. Below is my code....

```
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;

```