I want to add \",\" to after every group of 3 digits. Eg : when I type 3000000 the textbox will display 3,000,000 but the value still is 3000000. I tried to use maskedte
You could hook up to OnKeyUp event like this:
private void textBox1_KeyUp(object sender, KeyEventArgs e) { if (!(e.KeyCode == Keys.Back)) { string text = textBox1.Text.Replace(",", ""); if (text.Length % 3 == 0) { textBox1.Text += ","; textBox1.SelectionStart = textBox1.Text.Length; } } }